Android ExoPlayer - downloading video (non DASH / HLS) and streaming at the same time Android ExoPlayer - downloading video (non DASH / HLS) and streaming at the same time android android

Android ExoPlayer - downloading video (non DASH / HLS) and streaming at the same time


I found a solution with just an issue: seeking backward or forward is not working.

This is the piece of code:

public void preparePlayer(String videoUri) {    MediaSource videoSource =            new ExtractorMediaSource( Uri.parse( videoUri ), dataSourceFactory, extractorsFactory, handler, null );    exoPlayer.prepare( videoSource );    exoPlayer.setPlayWhenReady( true );}public DataSource.Factory buildDataSourceFactory() {    return new DataSource.Factory() {        @Override        public DataSource createDataSource() {            LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor( CACHE_SIZE_BYTES );            File cacheDir = //Your cache dir            SimpleCache simpleCache = new SimpleCache( cacheDir, evictor );            DataSource dataSource = buildMyDataSourceFactory().createDataSource();            int cacheFlags = CacheDataSource.FLAG_BLOCK_ON_CACHE | CacheDataSource.FLAG_CACHE_UNBOUNDED_REQUESTS;            return new CacheDataSource( simpleCache, dataSource, cacheFlags, CACHE_SIZE_BYTES );        }    };}private DefaultDataSource.Factory buildMyDataSourceFactory() {    return new DefaultDataSourceFactory( context, "jesty-android", new DefaultBandwidthMeter() );}

Source: https://github.com/google/ExoPlayer/issues/420#issuecomment-244652023