gpt4 book ai didi

ios - 无法使用 MPMoviePlayerController 从视频中获取多个图像。操作系统状态 -12433

转载 作者:可可西里 更新时间:2023-11-01 03:33:11 24 4
gpt4 key购买 nike

我正在尝试使用 MPMoviePlayerController 从选定的视频文件中提取多个图像。下面是我写的代码。

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];
}
}

但是我收到以下错误消息:

  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 错误 -12433 的描述吗?我尝试搜索有关 OSStatus 错误代码的文档,但没有成功。

如有任何帮助,我们将不胜感激。

最佳答案

我必须将时间添加为 float :

NSNumber *time1 = [NSNumber numberWithFloat:1.f];

关于ios - 无法使用 MPMoviePlayerController 从视频中获取多个图像。操作系统状态 -12433,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14297726/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com