AVURLAsset的缓存行为 [英] Caching behavior of AVURLAsset

查看:247
本文介绍了AVURLAsset的缓存行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将AVURLAsset与各种AV/MP播放器类一起使用,似乎正在忽略服务器的缓存头.我正在处理逐步下载的小型视频(不是HLS).

I am using AVURLAsset with various AV/MP player classes and it seems like it is ignoring my server's caching headers. I am working with small, progressively downloaded videos (not HLS).

有没有办法确保视频被缓存?是否可以预缓存视频以便立即播放?我已经尝试过简单地更改NSURLCache中的参数,但是到目前为止,我还没有碰到任何运气.我也找不到任何直接方法来操纵AVURLAsset缓存URL提取的方式.

Is there a way to ensure that videos are cached? Is there a way to pre-cache videos so they play right away? I have experimented with simply changing parameters in NSURLCache, but I haven't had any luck so far. I also can't find any direct way to manipulate how URL fetches are cached by AVURLAsset.

我不想单独下载文件并指向本地版本,因为我不想等到文件完全下载后才能开始播放.理想情况下,我也想避免自己管理本地磁盘缓存.

I do not want to download the file separately and point to the local version, because I do not want to wait for the file to be completely downloaded before I can start playing. Ideally, I'd also like to avoid managing a local disk cache myself.

推荐答案

有一个名为AVAssetResourceLoader的类.我认为您应该实现AVAssetResourceLoaderDelegate的两种方法

There is class called AVAssetResourceLoader. I think you should implement two methods of AVAssetResourceLoaderDelegate

更多信息此处.

这篇关于AVURLAsset的缓存行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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