Caching behavior of AVURLAsset

2.1k views Asked by At

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 are 1 answers

1
typedef On

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

More info here.