简体   繁体   English

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

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

I am new to iphone development,I am parsing a XML URL and display its content in the table, when i click a row , its corresponding parsed tube URL is played using the movie player.I am using media player framework.Here is my code 我是iphone开发的新手,我正在解析XML URL并在表格中显示其内容,当我点击一行时,它使用电影播放器​​播放其相应的解析管URL。我正在使用媒体播放器框架。这是我的代码

NSURL *movieURL = [NSURL URLWithString:requiredTubeUrl];

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

    [myMovie initAndPlayMovie:movieURL];

}

}

This is working fine, but i want to play the video using "HTTP Live Streaming".How can i do that? 这工作正常,但我想使用“HTTP Live Streaming”播放视频。我该怎么做? Any tutorials and sample code would me more helpful.Thanks. 任何教程和示例代码都会对我更有帮助。谢谢。

Apple provides and overview and some sample pages with streams. Apple提供了概述和一些带有流的示例页面。 You provide the playlist file (.M3U8) URL to your MPMoviePlayer instance. 您将播放列表文件(.M3U8)URL提供给MPMoviePlayer实例。 If your server is set up properly, the .M3U8 file URL should suffice. 如果您的服务器设置正确,.M3U8文件URL就足够了。

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

Use MPMoviePlayerController for streaming from server. 使用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];
       }
}

To implement in for the browser, which applies for a lot to native app development since it directs iphone users to movie app. 实现浏览器,因为它将iphone用户引导到电影应用程序,因此适用于本机应用程序开发。 A lot depends on the proper stream you're wanting to view http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/ 很大程度上取决于您想要查看的正确流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