我正在使用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];
Run Code Online (Sandbox Code Playgroud)
它总是给我错误:
错误域= AVFoundationErrorDomain代码= -11800"操作无法完成"UserInfo = 0x7fb4e30cbfa0 {NSUnderlyingError = 0x7fb4e0e28530"操作无法完成.(OSStatus error -12782.)",NSLocalizedFailureReason =发生未知错误(-12782) ),NSLocalizedDescription =操作无法完成}
它适用于mp4,mov和所有主要视频扩展URL但不适用于m3u8.任何的想法??