iPhone MPMoviePlayerController:在流媒体下载文件并在本地播放 [英] iPhone MPMoviePlayerController : download files while streaming en play them locally

查看:149
本文介绍了iPhone MPMoviePlayerController:在流媒体下载文件并在本地播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的m3u8文件包​​含所有TS文件。 MPMoviePlayerController通过流媒体服务器上的http请求播放它们。但是我想在本地获取这些文件,以便以后再玩它们而不需要任何连接。

I've m3u8 file with all the TS files. MPMoviePlayerController play them fine via http request on the streaming server. But I'd like to get the files locally in order to play them again later without any connection.

我设法在我的本地下载m3u8文件和所有TS文件设备,我编辑m3u8文件指向本地.ts而不是http。但我无法从这个安置中读取它们。
(VLC可以做得很好)

I managed to download m3u8 file and all the TS files locally on my device, I edited m3u8 files to point to local .ts instead of http ones, but I can't read them from this emplacement. (VLC can do it well)

有没有办法在播放时下载片段(避免2次下载)然后用MPMoviePlayerController在本地播放它们要不然。

Is there a way to download the segments while playing (to avoid 2 downloads) and then to play them locally with MPMoviePlayerController or else.

推荐答案

.m3u8是Apple HTTP Live Streaming,对吗?我认为你所做的只是违背了该技术的设计。你应该公开原始文件并允许它下载。

.m3u8 is Apple HTTP Live Streaming, right? I think what you're trying to do simply goes against the design of that technology. You should expose the original file and allow it to be downloaded.

根据我的理解,在流媒体设计中你没有明确访问这些文件为了把它们重新组合在一起。例如,Netflix通过Silverlight使用流媒体,其中一个好处(对Netflix)是保护数据不被保存,就像下载一样。此外,由于HTTP Live Streaming允许流动地切换比特率,因此它的设计使得每个时间片可以以任意数量的比特率进行编码,并且它们都不是规范的。

From what I understand, it's in the design of streaming that you don't get explicit access to the pieces in order to put them back together. For instance, Netflix uses streaming via Silverlight, and one of the benefits (to Netflix) is that it protects the data from being saved as if it were downloaded. Also, since HTTP Live Streaming allows a stream to switch bitrates on the fly, it's designed such that each time slice can be encoded at any number of bitrates, and none of them is canonical.

理论上,可能有一种方法可以收集特定比特率的所有切片,并将它们重新编码为单个视频。但Apple的回放API不会给你这个机会。

In theory, there might be a way to collect all the slices for a particular bitrate and re-encode them into a single video. But Apple's playback APIs are not going to give you that opportunity.

考虑渐进式下载,而不是HTTP Live Streaming。只需提供原始视频文件(如有必要,将其转码为iPhone喜欢的内容)。如果您的服务器配置正确,播放API将执行较小的请求以获取文件的特定块,而不是一次性完成所有内容,并且它恰好是正确的流式传输的第二个。我希望我能找到我读到的地方所以我可以给它正确的名称。如果您需要快速解决方案,Amazon S3将设置为以这种方式提供服务。

Instead of HTTP Live Streaming, consider progressive download. Just serve the original video file (transcode it to something the iPhone likes if necessary). If your server is configured properly, the playback APIs will do small requests to get particular chunks of the file, rather than the whole thing in one go, and it's a close second to proper streaming. I wish I could find where I read about this so I could give the proper name for it. Amazon S3 is set up to serve this way, if you need a quick solution.

但请注意, Apple的文档说,


如果您的应用提供超过
蜂窝网络的视频,并且视频
超过10分钟的持续时间或5美元的5美元b b b数据,
you需要使用HTTP Live
Streaming。 (逐步下载可以
用于较小的剪辑。)

If your app delivers video over cellular networks, and the video exceeds either 10 minutes duration or 5 MB of data in a five minute period, you are required to use HTTP Live Streaming. (Progressive download may be used for smaller clips.)

这篇关于iPhone MPMoviePlayerController:在流媒体下载文件并在本地播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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