NSInvalidArgumentException [NSURL长度] url视频记录iphone

时间:2012-10-04 16:55:14

标签: iphone url mpmediaplayercontroller

我通过iphone数据库应用程序保存视频,我正在录制视频的网址是:

文件://localhost/private/var/mobile/Applications/0DB3ABFC-1630-44FF-8506-4B08E3CB2C85/tmp/capture-T0x2591d0.tmp.00fEdr/capturedvideo.MOV

然而,当我尝试通过MediaPlayer阅读视频时,它总是崩溃......

示例代码:

NSString *frameName = [info objectForKey:@"UIImagePickerControllerMediaURL"];

NSURL *url = [NSURL URLWithString:frameName];

videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:videoPlayer.view];

videoPlayer.view.frame = CGRectMake(0, 0, 320, 419);
[videoPlayer play];

提前谢谢。

1 个答案:

答案 0 :(得分:1)

看起来[info objectForKey:@"UIImagePickerControllerMediaURL"]的内容无效。

如果有效,请尝试fileURLWithPath,而不是urlWithString