You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use DefaultDataSource or CacheDataSource to load the data.
Result:
if I use DefaultDataSource:
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, BANDWIDTH_METER,
new OkHttpDataSourceFactory(getOkHttpClient(), getUa(), BANDWIDTH_METER));
return new HlsMediaSource(uri, dataSourceFactory, mainHandler, eventLogger);
the ParsingLoadable will use datasource's uri: result = parser.parse(dataSource.getUri(), inputStream);
exoplayer will correctly use URL2's host "B" to join the ts segment url.
2. if I use CacheDataSource, however,exoplayer will use URL1's host "A", which is wrong, the response code will be 404:
CacheEvictor cacheEvictor = new LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024);
Cache cache = new SimpleCache(new File(getExternalCacheDir(), "media_cache"), cacheEvictor);
DataSource.Factory upstreamFactory = new OkHttpDataSourceFactory(getOkHttpClient(), getUa(), BANDWIDTH_METER);
DataSource.Factory dataSourceFactory = new CacheDataSourceFactory(cache, upstreamFactory, CacheDataSource.FLAG_BLOCK_ON_CACHE, 100 * 1024 * 1024);
return new HlsMediaSource(uri, dataSourceFactory, mainHandler, eventLogger);
The reason is, DefaultDataSource.getUri() calls OkHttpDataSource.getUri(), which handle 302 correctly.But CacheDataSource.getUri() will just return the original uri, which is wrong.
The version of ExoPlayer is r2.1.1.
The text was updated successfully, but these errors were encountered:
cr1944
changed the title
Can get correct ts url with CacheDataSource when playing hls with a 302 status code
Can't get correct ts url with CacheDataSource when playing hls with a 302 status code
Jan 23, 2017
the ParsingLoadable will use datasource's uri:
result = parser.parse(dataSource.getUri(), inputStream);
exoplayer will correctly use URL2's host "B" to join the ts segment url.
2. if I use CacheDataSource, however,exoplayer will use URL1's host "A", which is wrong, the response code will be 404:
The reason is, DefaultDataSource.getUri() calls OkHttpDataSource.getUri(), which handle 302 correctly.But CacheDataSource.getUri() will just return the original uri, which is wrong.
The text was updated successfully, but these errors were encountered: