|
1 year ago | |
---|---|---|
.. | ||
KTVHTTPCache | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago |
KTVHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources.
To integrate KTVHTTPCache into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'KTVHTTPCache', '~> 2.0.0'
Run pod install
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.
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];
Log.
// Console.
[KTVHTTPCache logSetConsoleLogEnable:YES];
// File.
[KTVHTTPCache logSetRecordLogEnable:YES];
NSString *logFilePath = [KTVHTTPCache logRecordLogFilePath];
KTVHTTPCache is released under the MIT license.