How to pre-cache HLS adaptive stream in ExoPlayer?


This Content is from Stack Overflow. Question asked by Abhay Kumar Tiwari

I am trying to pre-cache/pre-buffer HLS videos to my app. I used CacheWriter to cache the (.mp4) file, But it was not able to cache segments of HLS video. Basically, I have only URL of the master playlist file which has media playlists of different qualities, and that each media playlist has segments (.ts).

So, I have to cache the master playlist and any one media playlist and then some segments and play the cached media to Exoplayer. how can I cache these?
I also visited But this does not have any example to do so.

This is how I cached .mp4 by CacheWriter

    CacheWriter cacheWriter = new CacheWriter( mCacheDataSource,



This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?