I recorded a video and copied it to the path
NSURL *videoPath =[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUsersDomainMask,YES) objectAtIndex:0],@"/output.mov"]];
Then use MPMoviePlayer to play it:
MPMoviePlayerController *player = [[MPMovieController alloc] initWithContentURL:videoPath];
This does not work. The video can’t get loaded. The file path is
"/var/mobile/Applications/12341235-12354125-123412-41/Documents/output.mov"
Does anyone know why?
For some weird reason,
MPMoviePlayerControllerdoesn’t seem to like certainNSURLs even though they are deemed as valid objects.The “secret” is to get the file path as
NSStringand then use[NSURL fileURLWithPath:URLStringPath]to create the URLs your are using to create theMPMoviePlayerControllerinstance.