Nicolas
Nicolas

Reputation: 5809

NSInvalidArgumentException [NSURL length] url video record iphone

I save a video via iphone database application,the url where i'm recording the video is:

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

However, when I try to read the video via MediaPlayer it always crashes...

sample code:

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

Thank you in advance.

Upvotes: 1

Views: 491

Answers (1)

Mundi
Mundi

Reputation: 80273

Looks like the contents of [info objectForKey:@"UIImagePickerControllerMediaURL"] is not valid.

If it is valid, try fileURLWithPath rather then urlWithString.

Upvotes: 1

Related Questions