Caching behavior of AVURLAsset

久未见 提交于 2019-12-14 03:14:31

问题


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).

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.


回答1:


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

More info here.



来源:https://stackoverflow.com/questions/35757459/caching-behavior-of-avurlasset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!