116

GitHub - ChangbaDevs/KTVHTTPCache: 音视频在线播放缓存框架

 6 years ago
source link: https://github.com/ChangbaDevs/KTVHTTPCache
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

KTVHTTPCache

KTVHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources.

Flow Chart

KTVHTTPCache Flow Chart

Features

  • Thread safety.
  • Logging system, Support for console and file output.
  • Accurate view caching information.
  • Provide different levels of interface.
  • Adjust the download configuration.

Installation

Installation with CocoaPods

To integrate KTVHTTPCache into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'KTVHTTPCache', '~> 2.0.0'

Run pod install

Installation with Carthage

To integrate KTVHTTPCache into your Xcode project using Carthage, specify it in your Cartfile:

github "ChangbaDevs/KTVHTTPCache" ~> 2.0.0

Run carthage update to build the framework and drag the built KTVHTTPCache.framework and KTVCocoaHTTPServer.framework into your Xcode project.

Usage

  • Start proxy.
[KTVHTTPCache proxyStart:&error];
  • Generated proxy URL.
NSURL *proxyURL = [KTVHTTPCache proxyURLWithOriginalURL:originalURL];
AVPlayer *player = [AVPlayer playerWithURL:proxyURL];
  • Get the complete cache file URL if existed.
NSURL *completeCacheFileURL= [KTVHTTPCache cacheCompleteFileURLWithURL:originalURL];
  • Set the URL filter processing mapping relationship.
[KTVHTTPCache encodeSetURLConverter:^NSURL *(NSURL *URL) {
    return URL;
}];
  • Download Configuration
// Timeout interval.
[KTVHTTPCache downloadSetTimeoutInterval:30];

// Accept Content-Type.
[KTVHTTPCache downloadSetAcceptableContentTypes:contentTypes];

// Set unsupport Content-Type filter.
[KTVHTTPCache downloadSetUnacceptableContentTypeDisposer:^BOOL(NSURL *URL, NSString *contentType) {
    return NO;
}];

// Additional headers.
[KTVHTTPCache downloadSetAdditionalHeaders:headers];

// Whitelist headers.
[KTVHTTPCache downloadSetWhitelistHeaderKeys:headers];
// Console.
[KTVHTTPCache logSetConsoleLogEnable:YES];

// File.
[KTVHTTPCache logSetRecordLogEnable:YES];
NSString *logFilePath = [KTVHTTPCache logRecordLogFilePath];

License

KTVHTTPCache is released under the MIT license.

Feedback

Developed by Single

  • SGPlayer - A powerful media player framework for iOS, macOS, and tvOS.
  • KTVVideoProcess - A High-Performance video effects processing framework.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK