0

To play a video using AVPlayerViewController, the code below works well:

-(void)openVideo{
    NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
    AVPlayer *player = [AVPlayer playerWithURL:videoURL];
    AVPlayerViewController *playerViewController = [AVPlayerViewController new];
    playerViewController.player = player;
    [self.view addSubview: playerViewController.view];
    playerViewController.view.frame = self.view.frame;
    [player play];
    [self presentViewController:playerViewController animated:YES completion:nil];
}

Now I am getting the url like this:

<div class="first-video"><iframe width="560" height="315" src="https://www.youtube.com/embed/8aMHGC6A5zc" frameborder="0" allowfullscreen></iframe></div>

How to play this kind of (youtube) url in AVPlayer?

Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159
pkc456
  • 8,350
  • 38
  • 53
  • 109

0 Answers0