当飞行模式开启时,无法在iOS 7中播放本地视频流

fre*_*ler 14 objective-c ios ios7

我启动了一个本地http服务器来提供视频流:

http://localhost:55736/videos/foo.m3u8
Run Code Online (Sandbox Code Playgroud)

并用MPMoviePlayerController它来玩.无论飞行模式是否开启,它在iOS6中都能很好地工作.

但是在iOS 7中,当飞行模式开启(或关闭WIFI和蜂窝数据网络)时,我得到了错误:

_itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
Run Code Online (Sandbox Code Playgroud)

}

MPMoviePlayerPlaybackDidFinishNotification处理程序:

NSConcreteNotification 0x146c35c0 {
  name = MPMoviePlayerPlaybackDidFinishNotification; 
  object = <MPMoviePlayerController: 0x14682b90>;
  userInfo = {
    MPMoviePlayerPlaybackDidFinishReasonUserInfoKey = 1;
    error = "Error Domain=MediaPlayerErrorDomain Code=-11800....
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 18

尝试使用127.0.0.1而不是localhost.它对我有用

  • 看起来Apple在名称解析代码中破坏了一些东西...解析localhost不需要连接 - 它应该在/ etc/hosts或等效. (2认同)