1) 已经下载完毕,直接使用资源路径
2) 部分下载,使用资源路径,并开始下载
3) 没有下载,开始边下边播
if ([ZFPlayerCacheManager isfinishedLoadedWithURL:urlString]) {
///已经下载完毕
NSString *path = [[ZFPlayerCacheManager shareManager] diskCachePathForURL:urlString];
mutedUrl = [NSURL fileURLWithPath:path];
} else if ([ZFPlayerCacheManager hasDownLoadPartWithURL:urlString]) {
// 只下载了一部分, 则需要继续下载
NSString *path = [[ZFPlayerCacheManager shareManager] diskCachePathForURL:urlString];
mutedUrl = [NSURL fileURLWithPath:path];
[[ZFPlayerCacheManager shareManager] startDownWithUrl:assetURL downInfo:^(long long totalSize, NSHTTPURLResponse * _Nonnull response) {
} progress:^(float progress) {
}];
} else {
mutedUrl = [urlString urlScheme:@"streaming"];
self.currentPlayerManager.loadResource = YES;
NSURLComponents *components = [[NSURLComponents alloc] initWithURL:assetURL resolvingAgainstBaseURL:NO];
self.currentPlayerManager.originalScheme = components.scheme;
}
self.assetURL = mutedUrl;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)