views:

29

answers:

2

I am playing video from a local file in my application and it works properly, but then suddenly playing the video crashes the application with this error:

2010-03-10 11:34:20.235 SanjeevKapoor[1560:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Content URL must not be nil.'

This is the code where I get the crash:

-(void)initAndPlayMovie:(NSURL *)movieURL
{
   // Initialize a movie player object with the specified URL
   MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]  initWithContentURL:movieURL];  // This line causes the crash
   if (movieURL)
   {
      . . .
   }
}
A: 

You are handing the movieURL to the MPMoviePlayerController before checking if it's nil. You have to do it after the check.

Felixyz
A: 

Put NSLog(movieURL); before statement and check what it is printing... is it printing valid URL...?

What exactly it is printing?

mihirpmehta