MPMoviePlayerController iOS流m3u8文件不能正常工作

时间:2016-07-28 03:08:38

标签: ios mpmovieplayercontroller m3u8 mpmoviewcontroller

我尝试使用此代码播放m3u8直播文件:

       NSURL *movieURL = [NSURL URLWithString:@"http://www.streaming507.com:1935/TVBlast/TVBlast/playlist.m3u8"];



    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

        [self.view addSubview:mp.view];

        [mp setFullscreen:YES animated:YES];
    mp.movieSourceType = MPMovieSourceTypeStreaming;

        [mp play];


}

当我在safari浏览器中复制/粘贴streaming507.com:1935/TVBlast/TVBlast/playlist.m3u8时,它的播放效果非常好,我能解决这个问题吗?

我不知道我做错了什么

谢谢

1 个答案:

答案 0 :(得分:0)

我通过在info.plist中复制/粘贴来解决问题:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>