MPMoviePlayerController 成功预加载后将视频缓存到磁盘 [英] Caching videos to disk after successful preload by MPMoviePlayerController

查看:26
本文介绍了MPMoviePlayerController 成功预加载后将视频缓存到磁盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 MPMoviePlayerController 的 initWithContentURL: 启动视频后,是否可以缓存下载的视频,以便下次播放视频时可以通过本地 file://URI 加载?我知道可以自己下载并然后启动电影播放器​​,但是我想利用播放器在预加载完成之前启动的功能.

After launching a video using MPMoviePlayerController's initWithContentURL:, is it possible to cache the downloaded video so that the next time the video is played it can be loaded via a local file:// URI? I understand that it's possible to do my own downloading and then launch the movie player, however I would like to take advantage of the player's ability to start prior to completion of preload.

推荐答案

一个技巧,就是开始下载到磁盘——(使用 atomic : YES),等待 10 秒,然后将电影播放器​​指向本地磁盘路径.它会在播放不完整的文件时下载".

one trick, is to start the download to disk - (using atomic : YES), wait 10 seconds, and point the movie player to the local disk path. it will "download" while playing the incomplete file.

下次,先检查文件是否存在.

next time, just check if the file exists first.

我在 WIFI 连接上工作得很好,但在 3G 上有各种崩溃.

I got this working pretty well on WIFI connections, but on 3G there were all kinds of crashyness.

更糟糕的是,存在不完整的本地文件问题.让我知道它是否值得.

worse, there were issues with incomplete local files. let me know if it is worth it.

这篇关于MPMoviePlayerController 成功预加载后将视频缓存到磁盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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