views:

36

answers:

1

In 3.0, I could register for MPMoviePlayerContentPreloadDidFinishNotification and detect if the movie preloaded or failed, depending on whether there was an error object. Can anyone tell me the equivalent of the two cases for iOS4?

[Update: Responding to the first comment here because the max comment length is too short.]

If you successfully play a movie on iOS4, you get:

  • MPMoviePlayerContentPreloadDidFinishNotification with no error object (deprecated)
  • MPMoviePlayerLoadStateDidChangeNotification and player.loadState=MPMovieLoadStatePlayable
  • MPMoviePlayerPlaybackDidFinishNotification and player.loadState=MPMovieLoadStatePlaythroughOK

If it fails (for instance because of an incorrect URL), you get:

  • MPMoviePlayerPlaybackDidFinishNotification loadState=MPMovieLoadStateUnknown

And that's it. No MPMoviePlayerContentPreloadDidFinishNotification with an error object like in 3.0, no MPMoviePlayerLoadStateDidChangeNotification. So is the only way to detect a failed load to inspect the player.loadState for MPMovieLoadStateUnknown in MPMoviePlayerPlaybackDidFinishNotification?

It seems counterintuitive, to say the least.

A: 

Register for the MPMoviePlayerLoadStateDidChangeNotification notification, and then check the loadState property of the MPMoviePlayerController.

Source: ADC Developer Documentation

jrtc27