简体   繁体   中英

Video Not playing in iOS 10

In the following code:

// NSURL *videoURL1 = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"]];
NSURL *videoURL2 = [NSURL URLWithString:[NSString stringWithFormat:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"]];



AVPlayer *playerV = [AVPlayer playerWithURL:videoURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = playerV;

[self presentViewController:playerViewController animated:YES completion:^{
    [playerV play];
}];

VideoURL1 is working but videoURL2 is not working and the screen is like this:

单击此处获取屏幕截图

I added keys and values in info.plist:

点击此处获取屏幕截图

Reason behind not working you second url is that you are whitelisting only " http://www.ebookfrenzy.com " which does not support support secure connection. You should also whitelist "clips.vorwaerts-gmbh.de" in the same manner you have whitelisted " http://www.ebookfrenzy.com " . If you are going to access video from many site dynamically which does not support secure connection(https) then and the below line in your plist.

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

For more detail have a look on following thread-

How do I load an HTTP URL with App Transport Security enabled in iOS 9?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM