title: Play video in objective-C
body: <p>I have a ViewController in which I'm trying to play a video. The video is locally added in my project but when I open the ViewController it shows any error and app crashes, the error is this,</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
  </code></pre>
  
  <p>My code is this,</p>
  
  <pre><code>NSString *path=[[NSBundle mainBundle]pathForResource:@"Video" ofType:@"mp4"];
  NSURL *url = [NSURL fileURLWithPath:path];
  AVPlayer *player = [AVPlayer playerWithURL:url];
  AVPlayerViewController *controller = [[AVPlayerViewController alloc]init];
  controller.view.frame = self.view.bounds;
  [self.view addSubview:controller.view];
  [player play];
  </code></pre>