我正在使用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。有任何想法吗?