0

I want to make a demo app that plays video loaded from the network just with following sample code:

- (void)viewDidLoad {
    [super viewDidLoad];

    NSURL *url = [NSURL URLWithString:@"http://ftp.cp.108tian.com/video/unity_animation.mov"];
    AVPlayer *avp = [[AVPlayer alloc]initWithURL:url];

    AVPlayerViewController *avpc = [[AVPlayerViewController alloc]init];
    avpc.player = avp;

    [self presentViewController:avpc animated:YES completion:nil];

}

And yes, I have added the AST to allow HTTP transmission:

enter image description here

But I still get this error:

enter image description here

What happened? and how to solve this?

armnotstrong
  • 8,605
  • 16
  • 65
  • 130

1 Answers1

0

Present should be in viewDidAppear/viewWillAppear in addition to a valid url

[self presentViewController:avpc animated:YES completion:nil];
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
  • still the same error code -999 after moving the code to `viewDidAppear` and I have tried the other [online source](https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4) for this to make sure the video file is ok – armnotstrong Jun 20 '18 at 03:50