繁体   English   中英

如何在iphone中使用“HTTP Live Streaming”播放视频?

[英]How play the video using “HTTP Live Streaming” in iphone?

我是iphone开发的新手,我正在解析XML URL并在表格中显示其内容,当我点击一行时,它使用电影播放器​​播放其相应的解析管URL。我正在使用媒体播放器框架。这是我的代码

NSURL *movieURL = [NSURL URLWithString:requiredTubeUrl];

if (movieURL)
{
if ([movieURL scheme])  
{
    MoviePlayerController *myMovie = [[MoviePlayerController alloc]init];

    [myMovie initAndPlayMovie:movieURL];

}

}

这工作正常,但我想使用“HTTP Live Streaming”播放视频。我该怎么做? 任何教程和示例代码都会对我更有帮助。谢谢。

Apple提供了概述和一些带有流的示例页面。 您将播放列表文件(.M3U8)URL提供给MPMoviePlayer实例。 如果您的服务器设置正确,.M3U8文件URL就足够了。

http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008332-CH1-DontLinkElementID_29

使用MPMoviePlayerController从服务器进行流式传输。

-(void)initAndPlayMovie:(NSURL *)movieURL
{
    // Initialize a movie player object with the specified URL
       MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
       if (mp)
       {
           [self.moviePlayer play];
       }
}

实现浏览器,因为它将iphone用户引导到电影应用程序,因此适用于本机应用程序开发。 很大程度上取决于您想要查看的正确流http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM