Play video in objective C : I have a view controller in which I'm trying to play a video. The video is locally added in my project but when I open the view controller it shows any error and app crashes, the error is this,

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'

My code is this,

    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];