Skip to content

Latest commit

 

History

History
125 lines (79 loc) · 3.33 KB

README.md

File metadata and controls

125 lines (79 loc) · 3.33 KB

PrettyHTTPCache

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

PrettyHTTPCache 是一款 fork 自KTVHTTPCache的强大的视频缓存框架,它能够通过 HTTP 缓存视频内容

Flow Chart

KTVHTTPCache Flow Chart

Features

  • Thread safety(线程安全).
  • Logging system, Support for console and file output(支持 console 和 文件输出的日志系统).
  • 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];
  • Log.
// Console.
[KTVHTTPCache logSetConsoleLogEnable:YES];

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

License

PrettyHTTPCache is released under the MIT license.

PrettyHTTPCache和KTVHTTPCache一样采用 MIT license

Background Story

由于公司项目的需求,接触了下这个 KTVHTTPServer 这个项目,感觉很适合用于一些小项目的 视频缓存。但是,很遗憾的是此项目不再进行维护,因而我 fork 了进行重新开发,以满足我的需求。 本人是第一次 fork 项目进行开发,不知道有哪里做的不足之处,还请指导。

Developed by Single

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