AVPlayer with local video file

ios, nsurl

Solution

Try using fileURLWithPath: method instead of URLWithString:

Problem

There is a little video part in my application. So i find this sample, which play mp4 video from url: http://www.sdkboy.com/?p=66 You can download sample here: http://www.sdkboy.com/tutorials/AVFoundation_Test3.zip But when I replace NSURL code ``` NSURL *url = [NSURL URLWithString:@"http://www.samkeeneinteractivedesign.com/videos/littleVid3.mp4"]; ``` With this one, for playing local video, player doesn't work. ``` NSURL *url = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"malina36" ofType:@"mp4"]]; ``` This file exist, i check it with ``` if ([[NSFileManager defaultManager] fileExistsAtPath:url.absoluteString]) { NSLog(@"yes"); } else { NSLog(@"no"); } ``` Can you help me?

Original source