【发布时间】:2020-10-08 10:39:44
【问题描述】:
我正在开发一个应用程序,我必须在其中显示 live streaming 的 youtube 视频。为此,我有服务器密钥和server URL。我尝试使用 AVPlayer 但不工作 请任何人提出任何方法来实现它,因为我已经经历了很多问题,但不幸的是没有找到任何解决方案。
Server URL rtmp://a.rtmp.youtube.com/live2
Stream name/key 41wu-5jzt-8sak-7xwe
我正在使用以下代码:
NSURL *streamURL = [NSURL URLWithString:@"*********"];
_streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL:streamURL];
[self.streamPlayer.view setFrame: self.view.bounds];
self.streamPlayer.controlStyle = MPMovieControlStyleEmbedded;
[self.view addSubview: self.streamPlayer.view];
[self.streamPlayer play];
【问题讨论】:
-
MPMoviePlayerController自 iOS 9 起已弃用。您应该切换到AVKit。我们不知道streamURL的值,如果它是错误的怎么办?我们不知道 but not working 到底是什么意思。 -
@zrzka 我正在共享 youtube Api--- 服务器 URL rtmp://a.rtmp.youtube.com/live2 流名称/密钥 41wu-5jzt-8sak-7xwe 请帮我解决它我从几天就被困在这个问题上
标签: ios objective-c youtube live-streaming