AVPlayerViewController不加载远程URL [英] AVPlayerViewController not loading remote URL
本文介绍了AVPlayerViewController不加载远程URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在AVPlayerViewController
中播放远程MP4视频:
I'm trying to play a remote MP4 video in an AVPlayerViewController
:
self.vcVideo = [[AVPlayerViewController alloc] init];
self.vcVideo.player = [AVPlayer playerWithURL:[NSURL URLWithString:videoURL]];
[self presentViewController:self.vcVideo animated:YES completion:^{
[self.vcVideo.player play];
}];
显示了视图控制器,但禁用了播放按钮:
The view controller is presented but the play button is disabled:
这是在iOS 9上.
推荐答案
在iOS9中,安全策略已更改.在您的日志中,您应该会看到有关安全性的信息.我认为您的远程视频网址是http而不是https.您应该将这些行添加到您的plist文件中.
In iOS9 security policy is changed. In your log you should see something about the security. I believe that your remote video url is http not https. You should add these lines to your plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
这篇关于AVPlayerViewController不加载远程URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文