How to detect movie preloaded/failed on iOS4?
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
andplayer.loadState=MPMovieLoadStatePlayable
MPMoviePlayerPlaybackDidFinishNotification
andplayer.loadState=MPMovieLoadStatePlayth开发者_如何学PythonroughOK
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.
Register for the MPMoviePlayerLoadStateDidChangeNotification
notification, and then check the loadState
property of the MPMoviePlayerController
.
Source: ADC Developer Documentation
精彩评论