同时流式传输和保存视频? [英] Simultaneously stream and save a video?

查看:132
本文介绍了同时流式传输和保存视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,其中一部分允许用户流/播放视频。我想限制功能,以便他们只有在有WiFi连接时才能流式传输视频。然后,我将保存视频,以便当他们只有3G(或更少)连接时,他们无法播放视频,只能重播手机上保存的视频。

I'm writing an app, part of which allows the user stream/play videos. I want to restrict the functionality so that they can only stream videos if they have a WiFi connection. I will then save the video so that when they have a 3G only (or lesser) connection they can't stream videos and can only replay videos that are saved on the phone.

理想情况下,我想让MPMoviePlayerController播放/播放电影,然后访问电影数据并保存。但是,MPMoviePlayerController api似乎不支持访问电影数据。

Ideally, I'd like to get MPMoviePlayerController to stream/play the movie and then access the movie data and save it. However, the MPMoviePlayerController api doesn't seem to support access to the movie data.

我想避免和下载然后播放场景。有什么想法?

I'd like to avoid and download-then-play scenario. Any ideas?

推荐答案

我想到了两个解决方案。
此解决方案都要求文件采用可以渐进式播放的格式,例如:你不需要整个文件来播放它(但这无论如何都是先决条件)。

Two solutions come to mind. Both this solutions require that the file is in a format that can be played progressive, e.g. that you don't need the whole file to be able to play it (but that would be a prerequisite anyway).


  1. 使用一个帖子下载数据并将其附加到文件,并从另一个线程播放该文件。现在,这需要您可以在MPMoviePlayerController中处理EOF事件并暂停播放,直到缓存文件被追加到然后恢复到同一点。

到目前为止,我看到人们这样做是不行的,因为MPMoviePlayerController无法处理EOF事件。 (尚未对我自己进行测试)[将视频缓存到磁盘在MPMoviePlayerController成功预加载后

So far what I've seen people doing this it doesn't work because MPMoviePlayerController can't handle the EOF event. (not tested it my self yet) [Caching videos to disk after successful preload by MPMoviePlayerController


  1. 从文件中跳过播放并设置本地HTTP服务器和流从那(在localhost上)。这也没有经过测试。
    想法是MPMoviePlayerController会更好地从HTTP流中处理丢失数据的事件,然后直接读取文件。
    下行可能是效率较低,但我认为这是CPU的微小增长。我不知道网络接口是否会处理它,但我认为它不是问题。

我留下这个答案作为维基,因为我没有可行的解决方案,但我也想要一个。

I leave this answer as a wiki, because I don't have a working solution but I too want one.

这篇关于同时流式传输和保存视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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