gpt4 book ai didi

ios - 如何使用 MPMoviePlayerController 播放 youtube 视频?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:24:22 26 4
gpt4 key购买 nike

我想播放 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];
}

最佳答案

您不能在 MPMoviePlayerController 中播放 YouTube 视频 URL。为此你必须使用

youtube-iso-player-helper - 但是你不能在 youtube-iso-player-helper 中播放私有(private)视频 URL

XCDYoutubeKit - 这违反了 YouTube 条款和服务。

关于ios - 如何使用 MPMoviePlayerController 播放 youtube 视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36448277/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com