0
votes

The app I am working on using MPMoviePlayerController to play video at remote urls. When I reuse the player to play more than one video and the url doesn't point to a video, the controller doesn't send any notification back. I've tried MPMoviePlayerPlaybackDidFinishNotification, MPMoviePlayerPlaybackStateDidChangeNotification and MPMoviePlayerLoadStateDidChangeNotification. None of them was sent.

I also tried to do a custom time out function and calls the player's stop function like below. But, nothing happens. MPMoviePlayerController just seems dead there and doing nothing.

[self performSelector:@selector(checkTimeout) withObject:theMovie afterDelay:15];

-(void) checkTimeout {
    [self.moviePlayer stop];
}

Does anyone know how to handle invalid url with MPMoviePlayerController?

2
show some additional code - Anbu.Karthik

2 Answers

0
votes

I found a kind of solution myself.

It seems MPMoviePlayerController has problem playing more than one urls. If the 2nd url doesn't point to a video or invalid, the player doesn't do anything. So, I ended up creating a new instance of the MPMoviePlayerController for every url and listening to MPMoviePlayerPlaybackDidFinishNotification.

0
votes

If you did not receive notification on invalid urls, then you should run a timer of duration max(initialplaybacktime, 0) and once you do not receive MPMoviePlayerReadyForDisplayDidChange notification within this time, generate an error that video is not available.