0

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:

click here for screenshot

I added keys and values in info.plist:

Click here for screenshot

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sekhar
  • 11
  • 2

1 Answers1

0

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?

Community
  • 1
  • 1
Pankaj Gupta
  • 146
  • 2
  • 8