问题
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:
This is on iOS 9.
回答1:
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>
来源:https://stackoverflow.com/questions/36044314/avplayerviewcontroller-not-loading-remote-url