Unable to play MP4 video file from mainBundle Unable to play MP4 video file from mainBundle ios ios

Unable to play MP4 video file from mainBundle


This means your code can't find your introvideo.mp4 file. Make sure you have successfully add that file to your bundle. You can check in your project's setting: Copy Bundle Resource.enter image description here


Your code isn't correct. Please change accordingly to the following. Still copy your video into your bundle resources.

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]                                     pathForResource:@"MacBook Pro with Retina Display" ofType:@"m4v"]];MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc]                                                 initWithContentURL:url];[self presentMoviePlayerViewControllerAnimated:playercontroller];playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;[playercontroller.moviePlayer play];[playercontroller release];playercontroller = nil;NSLog(@"Video is Playing");


It seems that pathForResource:ofType: returns nil. Check that

  1. this file is indeed added to "copy resources" build phase;
  2. you didn't make mistake in the name of file - paths on device are case-sensitive.