KTVHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources.
- Thread safety.
- Keep proxy server alive when app enter background.
- Logging system, Support for console and file output.
- Accurate view caching information.
- Provide different levels of interface.
- Adjust the download configuration.
To integrate KTVHTTPCache into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'KTVHTTPCacheV2', '~> 2.0.4'
Run pod install
- 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;
}];
- Keep proxy server alive when app enter background.
// keep proxy server alive when app goes into background
[KTVHTTPCache keepAliveInBackground:YES];
- 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.
- GitHub : Single
- Email : [email protected]
- SGPlayer - A powerful media player framework for iOS, macOS, and tvOS.
- KTVVideoProcess - A High-Performance video effects processing framework.