Iphone MPMoviePlayerController "the server is not correctly configured"?
On the iphone, when trying to play a broken url using MPMoviePlayerContr开发者_Python百科oller the user gets an alertbox with the message "the server is not correctly configured".
Is there any way to change this to something more user-friendly? Alternatively, is there any way to get an error status from the player instead of getting this message?
Thanks in advance..
MPMoviePlayer provides two notifications for the case of a broken / invalid movie URL:
From MPMoviePlayer initWithContentURL:
To check for errors in URL loading, register for the MPMoviePlayerContentPreloadDidFinishNotification or MPMoviePlayerPlaybackDidFinishNotification notifications.
On error, these notifications contain an NSError object available using the @"error" key in the notification’s userInfo dictionary.
You should be able to hook to one oh these notifications and perform the needed actions
if a broken URL is about to be loaded.
Usually this error message means that the web server that's serving the file does not support HTTP byte ranges.
iPhone OS uses HTTP byte ranges for streaming audio and video content. This makes it possible to "scrub" forwards and backwards in the content without downloading the entire content first.
Once I've got this error when trying to play urlencoded url string. I removed urlencoding method call before ask MPMoviePlayerController to play url and everything ok.
精彩评论