How to pre-cache HLS adaptive stream in ExoPlayer?

Viewed 34

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 https://github.com/google/ExoPlayer/issues/9337 But this does not have any example to do so.

This is how I cached .mp4 by CacheWriter

    CacheWriter cacheWriter = new CacheWriter( mCacheDataSource,
                        dataSpec,
                        null,
                        progressListener);

    cacheWriter.cache();
0 Answers
Related