title: Playing a video file saved in the app's documents directory
body: <p>I have a video file saved in my app's local directory in the documents folder. I want to playback the file when the user clicks on the item in an embedded table view I created. My code for playing back the video is as follows: <br/></p>
  
  <pre><code>NSString* documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  NSString* path = [documentPath stringByAppendingPathComponent:@"DemoRecording.mp4"];
  NSURL* movieURL = [NSURL fileURLWithPath: path];
  [player.view setFrame: self.view.bounds];
  [self.view addSubView: player.view];
  [player play];
  MPMoviePlayerViewController* moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL: movieURL];
  [self presentMoviePlayerViewControllerAnimated: moviePlayer];
  </code></pre>
  
  <p>The video doesn't play back. The path is correct and the file exists there. <br/>
  I know this is a repetitive question. I have referred to these links:<br/>
  <a href="https://stackoverflow.com/questions/11549143/playing-a-downloaded-video-from-the-documents-directory-with-cocoa-touch">Playing a Downloaded Video from the Documents Directory with Cocoa-Touch</a><br/>
  <a href="https://stackoverflow.com/questions/3945121/mpmovieplayer-load-and-play-movie-saved-in-app-documents">MPMoviePlayer load and play movie saved in app documents</a><br/>
  But couldn't find a definitive answer. <br/>
  Please help me out on this one. I am using iOS 5.1.1, if that changes anything.</p>
  
  <p>EDIT:</p>
  
  <p>It does work. I had forgotten to pass the URL to the movie player.</p>