The server is not correctly configured (-12939)

2019-07-15 11:54发布

问题:

Trying to play MP3 from server without first downloading the file locally. Callback for MPMoviePlayerPlaybackDidFinishNotification comes with this:

NSConcreteNotification 0x7e1c980 {name = MPMoviePlayerPlaybackDidFinishNotification; object = <ItemMediaPlayer: 0x7856740>; userInfo = {
    MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 1;
    error = "Error Domain=MediaPlayerErrorDomain Code=-12939 \"The server is not correctly configured.\" UserInfo=0x7e243d0 {NSLocalizedDescription=The server is not correctly configured.}";

Now trying to figure out what does error code -12939 actually mean... Does MPMoviePlayerController expect that server must support byte range requests? Because this server does not (using nginx)!

To complicate things, this code fails on iOS 4.0, but works on iOS 4.1. Now thinking about dropping iOS 4.0 support, unless someone can propose a fix?

回答1:

Have a look at AudioStream, which allows you play a MP3 from a URL by streaming it.

The error could do with the fact that your server does not support "Range Requests".