Iphone 在另一个视图中打开电影流

Iphone 在另一个视图中打开电影流,iphone,ios,mpmovieplayercontroller,Iphone,Ios,Mpmovieplayercontroller,我的应用程序中有一个包含许多选项卡的选项卡视图,在其中一个选项卡中,我有一个按钮,单击该按钮时,我希望在视图中显示电影流。我有以下代码: NSString *moviePath = @"http://10.0.0.4/prog_index.m3u8"; theMovie = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:moviePath]]; [theMovie.view setFrame:

我的应用程序中有一个包含许多选项卡的选项卡视图,在其中一个选项卡中,我有一个按钮,单击该按钮时,我希望在视图中显示电影流。我有以下代码:

NSString *moviePath = @"http://10.0.0.4/prog_index.m3u8";

theMovie = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:moviePath]];

[theMovie.view setFrame:CGRectMake(0, 0, (self.view.frame.size.width), (self.view.frame.size.height))];

theMovie.view.backgroundColor = [UIColor grayColor];
theMovie.view.tag = 9999;

[self.view addSubview:[theMovie view]];

[theMovie play];
将显示视图,但视频不会启动。怎么了?

您正在向MPMoviePlayerController传递指向m3u8文件的URL。那是一个播放列表。要使用MPMoviePlayerController播放媒体,必须将其设置为实际的视频文件。您应该解析播放列表以获取到真实视频的链接,然后使用真实链接初始化您的
MPMoviePlayerController

检查和

也检查一下这个


编辑:多亏了,我意识到
MPMoviePlayerController
能够播放m3u8格式的实时流,因为我没有发现您的代码中有任何错误,我建议您检查这是否是流的问题。尝试使用苹果公司提供的一款手机。还要确保你的流满足苹果对

的要求,但在相关问题中,他说我可以播放播放列表文件,其余的由MPMoviePlayerController来完成。你是对的,我完全错了,我正在试图找出你的代码出了什么问题