如何使用MPMoviePlayerController播放youtube视频?

Mon*_*tel 2 youtube objective-c video-streaming ios

我想播放youtube网址的视频.我正在使用下面的代码,但它无法正常工作.

-(void)playVideoFromURL
{
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%s","https://www.youtube.com/embed/96ReVjMAXEE?autoplay=1&vq=small"]];
    self.videoController = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [self.videoController setControlStyle:MPMovieControlStyleNone];
    self.videoController.repeatMode=MPMovieRepeatModeOne;
    self.videoController.fullscreen=YES;
    self.videoController.scalingMode=MPMovieScalingModeFill;
    self.videoController.view.frame=CGRectMake(0,0,self.videoplayview.frame.size.width, self.videoplayview.frame.size.height);
    [self.videoplayview addSubview:self.videoController.view];
    [self.videoController play];
}
Run Code Online (Sandbox Code Playgroud)

Yog*_* Mv 5

您无法在MPMoviePlayerController中播放YouTube视频网址.为此你必须使用

youtube-iso-player-helper - 但你不能在youtube-iso-player-helper中播放私人视频网址

XCDYoutubeKit - 违反YouTube条款和服务.