DashDownloader
@UnstableApi
public final class DashDownloader extends SegmentDownloader
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.offline.SegmentDownloader | |
| ↳ | androidx.media3.exoplayer.dash.offline.DashDownloader |
A downloader for DASH streams.
Example usage:
SimpleCache cache = new SimpleCache(downloadFolder, new NoOpCacheEvictor(), databaseProvider); CacheDataSource.Factory cacheDataSourceFactory = new CacheDataSource.Factory() .setCache(cache) .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory()); // Create a downloader for the first representation of the first adaptation set of the first // period. DashDownloader dashDownloader = new DashDownloader.Factory(cacheDataSourceFactory) .create(new MediaItem.Builder() .setUri(manifestUrl) .setStreamKeys(ImmutableList.of(new StreamKey(0, 0, 0))) .build()); // Perform the download. dashDownloader.download(progressListener); // Use the downloaded data for playback. DashMediaSource mediaSource = new DashMediaSource.Factory(cacheDataSourceFactory).createMediaSource(mediaItem);
Summary
Nested types |
|---|
public final class DashDownloader.Factory extends SegmentDownloader.BaseFactoryA factory for |
Public constructors |
|---|
This method is deprecated. Use |
This method is deprecated. Use |
Protected methods |
|
|---|---|
List<SegmentDownloader.Segment> |
getSegments(Returns a list of all downloadable |
Inherited Constants |
||
|---|---|---|
|
Inherited fields |
||||
|---|---|---|---|---|
|
Inherited methods |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
DashDownloader
publicDashDownloader(
MediaItem mediaItem,
CacheDataSource.Factory cacheDataSourceFactory
)
DashDownloader
publicDashDownloader(
MediaItem mediaItem,
CacheDataSource.Factory cacheDataSourceFactory,
Executor executor
)
Protected methods
getSegments
protected List<SegmentDownloader.Segment> getSegments(
DataSource dataSource,
DashManifest manifest,
boolean removing
)
Returns a list of all downloadable Segments for a given manifest. Any required data should be loaded using getManifest or execute.
| Parameters | |
|---|---|
DataSource dataSource |
The |
DashManifest manifest |
The manifest containing the segments. |
boolean removing |
Whether the segments are being obtained as part of a removal. If true then a partial segment list is returned in the case that a load error prevents all segments from being listed. If false then an |
| Returns | |
|---|---|
List<SegmentDownloader.Segment> |
The list of downloadable |
| Throws | |
|---|---|
java.io.IOException |
Thrown if |
java.lang.InterruptedException |