这是我用来生成视频缩略图的代码:
当我使用这段代码时,会出现以下错误:
NSString *getUrl = [[NSUserDefaults standardUserDefaults] valueForKey:@"newpath"];
NSLog(@"getURL=%@",getUrl);
NSLog(@"newpath for url=%@",newPath);
NSURL *url = [NSURL URLWithString:getUrl];
AVURLAsset *asset=[[AVURLAsset alloc] initWithURL:url options:nil];
AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generator.appliesPreferredTrackTransform=TRUE;
[asset release];
CMTime thumbTime = CMTimeMakeWithSeconds(0,30);
AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime, CGImageRef im, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error){
if (result != AVAssetImageGeneratorSucceeded) {
NSLog(@"couldn't generate thumbnail, error:%@", error);
}
[btnVideo setImage:[UIImage imageWithCGImage:im] forState:UIControlStateNormal];
// thumbImg=[[UIImage imageWithCGImage:im] retain];
[generator release];
};
CGSize maxSize = CGSizeMake(320, 180);
generator.maximumSize = maxSize;
[generator generateCGImagesAsynchronouslyForTimes:[NSArray arrayWithObject:[NSValue valueWithCMTime:thumbTime]] completionHandler:handler];
当我使用这段代码时,会出现以下错误:
couldn't generate thumbnail, error:Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x5bbbb0 {NSLocalizedFailureReason=An unknown error occurred (-12935), NSUnderlyingError=0x59ae40 "The operation couldn’t be completed. (OSStatus error -12935.)", NSLocalizedDescription=The operation could not be completed}
有人能告诉我这是什么类型的错误吗?