【发布时间】:2016-07-26 16:30:21
【问题描述】:
我想播放 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];
}
【问题讨论】:
-
您面临的问题是什么?
-
我认为你不能在任何播放器中播放 youtube 视频,除了 youtube 自己的。他们有一个 SDK,您需要使用他们提供的 youtube 播放器来播放来自 youtube 的视频。
-
不可能使用
youtube-iso-player-helper和MPMoviePlayerController -
我也有同样的问题。你解决了吗?如果是的话,请指导我完成这个。还是您使用了其他场景、方法或播放器?
标签: ios objective-c youtube video-streaming