要使用 播放视频AVPlayerViewController
,下面的代码运行良好:
-(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];
}
现在我得到这样的网址:
<div class="first-video"><iframe width="560" height="315" src="https://www.youtube.com/embed/8aMHGC6A5zc" frameborder="0" allowfullscreen></iframe></div>
如何在 AVPlayer 中播放这种(youtube)网址?