本文介绍了无法使用MPMoviePlayerController从视频中获取多个图像。 OSStatus -12433的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用MPMoviePlayerController从选定的视频文件中提取多个图像。下面是我写的代码。
I'm trying to extract multiple images from a selected video file using MPMoviePlayerController. Below is the code I have written.
movie = [[MPMoviePlayerController alloc] initWithContentURL:[info objectForKey:UIImagePickerControllerMediaURL]];
NSNumber *time1 = [NSNumber numberWithInt:1];
NSNumber *time2 = [NSNumber numberWithInt:3];
NSNumber *time3 = [NSNumber numberWithInt:5];
NSArray *times = [NSArray arrayWithObjects:time1,time2,time3,nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleThumbnailImageRequestFinishNotification:) name:MPMoviePlayerThumbnailImageRequestDidFinishNotification object:movie];
[movie requestThumbnailImagesAtTimes:times timeOption:MPMovieTimeOptionExact];
这是通知的处理程序
-(void)handleThumbnailImageRequestFinishNotification:(NSNotification*)note
{
NSDictionary *userinfo = [note userInfo];
NSError* value = [userinfo objectForKey:MPMoviePlayerThumbnailErrorKey];
if (value!=nil)
{
NSLog(@"Error: %@", [value debugDescription]);
}
else
{
_imageView.image = [userinfo valueForKey:MPMoviePlayerThumbnailImageKey];
}
}
但是我收到以下错误消息:
However I get the following error message:
Error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1d8a63d0 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1d8b7b50 "The operation couldn’t be completed. (OSStatus error -12433.)", NSLocalizedFailureReason=An unknown error occurred (-12433)}
任何人都知道OSStatus Error -12433的描述?我尝试搜索有关OSStatus错误代码的文档,但未成功。
Anyone know the description for OSStatus Error -12433? I tried searching for documentation regarding OSStatus error codes but was unsuccessful.
非常感谢任何帮助。
推荐答案
我不得不将时间添加为浮点数:
I had to add the times as floats so:
NSNumber *time1 = [NSNumber numberWithFloat:1.f];
这篇关于无法使用MPMoviePlayerController从视频中获取多个图像。 OSStatus -12433的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!