zhongbaojian 60ccbc9f28 更新 'README.md' | %!s(int64=5) %!d(string=hai) anos | |
---|---|---|
VIMediaCache | %!s(int64=5) %!d(string=hai) anos | |
VIMediaCacheDemo | %!s(int64=5) %!d(string=hai) anos | |
VIMediaCacheDemo.xcodeproj | %!s(int64=5) %!d(string=hai) anos | |
VIMediaCacheDemoTests | %!s(int64=5) %!d(string=hai) anos | |
LICENSE | %!s(int64=5) %!d(string=hai) anos | |
README.md | %!s(int64=5) %!d(string=hai) anos | |
VIMediaCache.podspec | %!s(int64=5) %!d(string=hai) anos |
Cache media file while play media using AVPlayerr.
VIMediaCache use AVAssetResourceLoader to control AVPlayer download media data.
pod 'VIMediaCache', :git => 'http://svn.ouj.com:3000/duowan_iOS/VideoCache.git'
Objective C
NSURL *url = [NSURL URLWithString:@"https://mvvideo5.meitudata.com/571090934cea5517.mp4"];
VIResourceLoaderManager *resourceLoaderManager = [VIResourceLoaderManager new];
self.resourceLoaderManager = resourceLoaderManager;
AVPlayerItem *playerItem = [resourceLoaderManager playerItemWithURL:url];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
Swift
let url = URL(string: "https://mvvideo5.meitudata.com/571090934cea5517.mp4")
let resourceLoaderManager = VIResourceLoaderManager()
let playerItem = resourceLoaderManager.playerItem(with: url)
let player = AVPlayer(playerItem: playerItem)
vvitozhang@gmail.com
MIT