KTVHTTPCache

A media cache framework from Changba iOS Team.


Keywords
audio, cache, carthage, cocoapods, media, player, video
License
MIT
Install
pod try KTVHTTPCache

Documentation

KTVHTTPCache

KTVHTTPCache is a smart media cache framework. It can cache HTTP request, 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', '~> 1.1.6'

Run pod install

Installation with Carthage

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

github "ChangbaDevs/KTVHTTPCache" ~> 1.1.6

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 cacheCompleteFileURLIfExistedWithURL:originalURL];
  • Set the URL filter processing mapping relationship.
[KTVHTTPCache tokenSetURLFilter:^NSURL *(NSURL *URL) {
    return URL;
}];
  • Download Configuration
// Timeout interval.
[KTVHTTPCache downloadSetTimeoutInterval:30];

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

// Set unsupport Content-Type filter.
[KTVHTTPCache downloadSetUnsupportContentTypeFilter:^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];

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.