docs/doc/reference/com/google/android/exoplayer2/source/dash/offline/DashDownloader.html
Package com.google.android.exoplayer2.source.dash.offline
All Implemented Interfaces:Downloader
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDashDownloaderextends[SegmentDownloader](../../../offline/SegmentDownloader.html "class in com.google.android.exoplayer2.offline")<[DashManifest](../manifest/DashManifest.html "class in com.google.android.exoplayer2.source.dash.manifest")>
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
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(
new MediaItem.Builder()
.setUri(manifestUrl)
.setStreamKeys(Collections.singletonList(new StreamKey(0, 0, 0)))
.build(),
cacheDataSourceFactory);
// Perform the download.
dashDownloader.download(progressListener);
// Use the downloaded data for playback.
DashMediaSource mediaSource =
new DashMediaSource.Factory(cacheDataSourceFactory).createMediaSource(mediaItem);
-
SegmentDownloader.Segment
-
Downloader.ProgressListener
-
DEFAULT_MAX_MERGED_SEGMENT_START_TIME_DIFF_MS
Constructors | Constructor | Description |
| --- | --- |
| DashDownloader(MediaItem mediaItem, CacheDataSource.Factory cacheDataSourceFactory) |
Deprecated.
Creates a new instance.
|
| DashDownloader(MediaItem mediaItem, CacheDataSource.Factory cacheDataSourceFactory, Executor executor) |
Deprecated.
Creates a new instance.
|
| DashDownloader(MediaItem mediaItem, ParsingLoadable.Parser<DashManifest> manifestParser, CacheDataSource.Factory cacheDataSourceFactory, Executor executor) |
Deprecated.
Use DashDownloader(MediaItem, Parser, CacheDataSource.Factory, Executor, long) instead.
|
| DashDownloader(MediaItem mediaItem, ParsingLoadable.Parser<DashManifest> manifestParser, CacheDataSource.Factory cacheDataSourceFactory, Executor executor, long maxMergedSegmentStartTimeDiffMs) |
Deprecated.
Creates a new instance. |
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| protected List<SegmentDownloader.Segment> | getSegments(DataSource dataSource, DashManifest manifest, boolean removing) |
Deprecated.
Returns a list of all downloadable SegmentDownloader.Segments for a given manifest.
|
-
cancel, download, execute, getCompressibleDataSpec, getManifest, remove
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public DashDownloader([MediaItem](../../../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[CacheDataSource.Factory](../../../upstream/cache/CacheDataSource.Factory.html "class in com.google.android.exoplayer2.upstream.cache")cacheDataSourceFactory)
Deprecated.
Creates a new instance.
Parameters:mediaItem - The MediaItem to be downloaded.cacheDataSourceFactory - A CacheDataSource.Factory for the cache into which the download will be written.
-
public DashDownloader([MediaItem](../../../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[CacheDataSource.Factory](../../../upstream/cache/CacheDataSource.Factory.html "class in com.google.android.exoplayer2.upstream.cache")cacheDataSourceFactory,[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html "class or interface in java.util.concurrent")executor)
Deprecated.
Creates a new instance.
Parameters:mediaItem - The MediaItem to be downloaded.cacheDataSourceFactory - A CacheDataSource.Factory for the cache into which the download will be written.executor - An Executor used to make requests for the media being downloaded. Providing an Executor that uses multiple threads will speed up the download by allowing parts of it to be executed in parallel.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public DashDownloader([MediaItem](../../../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[ParsingLoadable.Parser](../../../upstream/ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<[DashManifest](../manifest/DashManifest.html "class in com.google.android.exoplayer2.source.dash.manifest")> manifestParser,[CacheDataSource.Factory](../../../upstream/cache/CacheDataSource.Factory.html "class in com.google.android.exoplayer2.upstream.cache")cacheDataSourceFactory,[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html "class or interface in java.util.concurrent")executor)
Deprecated.
Use DashDownloader(MediaItem, Parser, CacheDataSource.Factory, Executor, long) instead.
-
public DashDownloader([MediaItem](../../../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[ParsingLoadable.Parser](../../../upstream/ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<[DashManifest](../manifest/DashManifest.html "class in com.google.android.exoplayer2.source.dash.manifest")> manifestParser,[CacheDataSource.Factory](../../../upstream/cache/CacheDataSource.Factory.html "class in com.google.android.exoplayer2.upstream.cache")cacheDataSourceFactory,[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html "class or interface in java.util.concurrent")executor,
long maxMergedSegmentStartTimeDiffMs)
Deprecated.
Creates a new instance.
Parameters:mediaItem - The MediaItem to be downloaded.manifestParser - A parser for DASH manifests.cacheDataSourceFactory - A CacheDataSource.Factory for the cache into which the download will be written.executor - An Executor used to make requests for the media being downloaded. Providing an Executor that uses multiple threads will speed up the download by allowing parts of it to be executed in parallel.maxMergedSegmentStartTimeDiffMs - The maximum difference of the start time of two segments, up to which the segments (of the same URI) should be merged into a single download segment, in milliseconds.
-
protected[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[SegmentDownloader.Segment](../../../offline/SegmentDownloader.Segment.html "class in com.google.android.exoplayer2.offline")> getSegments([DataSource](../../../upstream/DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[DashManifest](../manifest/DashManifest.html "class in com.google.android.exoplayer2.source.dash.manifest")manifest,
boolean removing)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io"),[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang")
Deprecated.
Description copied from class: SegmentDownloader
Returns a list of all downloadable SegmentDownloader.Segments for a given manifest. Any required data should be loaded using SegmentDownloader.getManifest(com.google.android.exoplayer2.upstream.DataSource, com.google.android.exoplayer2.upstream.DataSpec, boolean) or SegmentDownloader.execute(com.google.android.exoplayer2.util.RunnableFutureTask<T, ?>, boolean).
Specified by:getSegments in class SegmentDownloader<DashManifest>Parameters:dataSource - The DataSource through which to load any required data.manifest - The manifest containing the segments.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 IOException will be thrown in this case.Returns:The list of downloadable SegmentDownloader.Segments.Throws:IOException - Thrown if allowPartialIndex is false and an execution error occurs, or if the media is not in a form that allows for its segments to be listed.InterruptedException