【发布时间】:2015-11-13 17:44:13
【问题描述】:
我正在使用 AVPlayer 播放 .m3u8 文件。 使用 AVAssetImageGenerator 使用以下代码从中提取图像:
AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:mp.contentURL options:nil];
AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1];
generate1.appliesPreferredTrackTransform = YES;
NSError *err = NULL;
CMTime time = CMTimeMake(1, 2);
CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err];
img = [[UIImage alloc] initWithCGImage:oneRef];
它总是给我错误:
Error Domain=AVFoundationErrorDomain Code=-11800“操作无法完成” UserInfo=0x7fb4e30cbfa0 {NSUnderlyingError=0x7fb4e0e28530“操作无法完成。(OSStatus错误-12782。)”,NSLocalizedFailureReason=发生未知错误(-12782), NSLocalizedDescription=操作无法完成}
它适用于 mp4、mov 和所有主要的视频扩展 URL,但不适用于 m3u8。有什么想法吗??
【问题讨论】:
-
mp 不为空?你能分享资产吗?
-
还有一点你的代码......
-
已添加代码@Daij-Djan
-
@objectivecdeveloper 这个运气好吗?现在我遇到了同样的要求。
标签: ios avfoundation avplayer avassetimagegenerator