MPMoviePlayerController与启动UIWebView以流式传输电影的优缺点 [英] Pros and cons of MPMoviePlayerController versus launching UIWebView to stream movie

查看:138
本文介绍了MPMoviePlayerController与启动UIWebView以流式传输电影的优缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户以Flash格式提供网络视频内容。我的任务是帮助他们在iPhone应用程序中显示视频。

I have a client who has video content for the web in Flash format. My task is to help them show the videos in an iPhone app.

我意识到第一步是将这些视频转换为适合iPhone的Quicktime格式。

I realize that step one is to get these videos into the appropriate Quicktime format for the iPhone.

然后我将不得不帮助客户找出如何或在何处托管这些文件。如果这很棘手,我认为它们可以在YouTube上托管。

Then I'm going to have to help the client figure out how or where to host these files. If that's tricky I assume they can be hosted at YouTube.

但我主要担心的是采用哪种方法来传输视频。 MPMoviePlayerController与使用流的URL启动UIWebView有什么优缺点?有什么区别吗?他们中的一个或多或少是宽容的吗?其中一个是更好的用户体验吗?我可能会遇到任何陷阱?

My chief concern, though, is which approach to take to stream the video. What are the pros and cons of MPMoviePlayerController versus launching UIWebView with the URL of the stream? Is there any difference? Is one of them more or less forgiving? Is one of them a better user experience? Any gotchas I might expect to run into?

我假设在iPhone上玩视频非常简单。尝试两者并将其作为后备可用是否合理,还是浪费时间?我正在努力安排这一点,所以我很乐意听到任何人这样做的真实经历。

I'm assuming playing video is pretty easy on the iPhone. Is it reasonable to try both and have one available as a fallback, or would that be a waste of time? I'm trying to schedule this out a bit, so I'd love to hear real-world experiences from anyone who's done this.

推荐答案

UIWebView实际上无法播放视频。使用UIWebview导航到Youtube页面只需启动iPhone的Youtube应用程序。以某种方式执行此操作将在播放视频后将控制权返回给您的应用。请参阅此处: http://iphoneincubator.com/blog/tag/uiwebview

UIWebView cannot actually play videos. Navigating to a Youtube page with a UIWebview will simply launch the iPhone's Youtube App. Doing this a certain way will return control to your app after the video is played. See here: http://iphoneincubator.com/blog/tag/uiwebview

我建议使用MPMoviePlayer Controller,只要你只做简单的流媒体。这里有一些示例代码可以帮助您入门:

I would recommend using MPMoviePlayer Controller, as long as you are only doing simple streaming. Here's some sample code to get you started:

NSString *url = @"http://www.example.com/path/to/movie.mp4";
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc]
                                        initWithContentURL:[NSURL URLWithString:url]];
[moviePlayer play];

这篇关于MPMoviePlayerController与启动UIWebView以流式传输电影的优缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆