docs/doc/reference/com/google/android/exoplayer2/offline/SegmentDownloader.html
Package com.google.android.exoplayer2.offline
Type Parameters:M - The type of the manifest object.All Implemented Interfaces:DownloaderDirect Known Subclasses:DashDownloader, HlsDownloader, SsDownloader
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public abstract classSegmentDownloader\<M extends [FilterableManifest](FilterableManifest.html "interface in com.google.android.exoplayer2.offline")\<M\>\>extends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Downloader](Downloader.html "interface in com.google.android.exoplayer2.offline")
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.
Base class for multi segment stream downloaders.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| protected static class | SegmentDownloader.Segment |
Deprecated.
Smallest unit of content to be downloaded. |
-
Downloader.ProgressListener
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static long | DEFAULT_MAX_MERGED_SEGMENT_START_TIME_DIFF_MS |
Deprecated.
|
Constructors | Constructor | Description |
| --- | --- |
| SegmentDownloader(MediaItem mediaItem, ParsingLoadable.Parser<M> manifestParser, CacheDataSource.Factory cacheDataSourceFactory, Executor executor) |
Deprecated.
Use SegmentDownloader(MediaItem, Parser, CacheDataSource.Factory, Executor, long) instead.
|
| SegmentDownloader(MediaItem mediaItem, ParsingLoadable.Parser<M> manifestParser, CacheDataSource.Factory cacheDataSourceFactory, Executor executor, long maxMergedSegmentStartTimeDiffMs) |
Deprecated.
|
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | cancel() |
Deprecated.
Permanently cancels the downloading by this downloader.
|
| void | download(Downloader.ProgressListener progressListener) |
Deprecated.
Downloads the content.
|
| protected <T> T | execute(RunnableFutureTask<T,?> runnable, boolean removing) |
Deprecated.
Executes the provided RunnableFutureTask.
|
| protected static DataSpec | getCompressibleDataSpec(Uri uri) |
Deprecated.
|
| protected M | getManifest(DataSource dataSource, DataSpec dataSpec, boolean removing) |
Deprecated.
Loads and parses a manifest.
|
| protected abstract List<SegmentDownloader.Segment> | getSegments(DataSource dataSource, M manifest, boolean removing) |
Deprecated.
Returns a list of all downloadable SegmentDownloader.Segments for a given manifest.
|
| void | remove() |
Deprecated.
Removes the content. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final long DEFAULT_MAX_MERGED_SEGMENT_START_TIME_DIFF_MS
Deprecated. See Also:Constant Field Values
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public SegmentDownloader([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[ParsingLoadable.Parser](../upstream/ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<[M](SegmentDownloader.html "type parameter in SegmentDownloader")> 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 SegmentDownloader(MediaItem, Parser, CacheDataSource.Factory, Executor, long) instead.
-
public SegmentDownloader([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")mediaItem,[ParsingLoadable.Parser](../upstream/ParsingLoadable.Parser.html "interface in com.google.android.exoplayer2.upstream")<[M](SegmentDownloader.html "type parameter in SegmentDownloader")> 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.
Parameters:mediaItem - The MediaItem to be downloaded.manifestParser - A parser for manifests belonging to the media 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.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.
-
public final void download(@Nullable[Downloader.ProgressListener](Downloader.ProgressListener.html "interface in com.google.android.exoplayer2.offline")progressListener)
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 interface: Downloader
Downloads the content.
If downloading fails, this method can be called again to resume the download. It cannot be called again after the download has been canceled.
If downloading is canceled whilst this method is executing, then it is expected that it will return reasonably quickly. However, there are no guarantees about how the method will return, meaning that it can return without throwing, or by throwing any of its documented exceptions. The caller must use its own knowledge about whether downloading has been canceled to determine whether this is why the method has returned, rather than relying on the method returning in a particular way.
Specified by:download in interface DownloaderParameters:progressListener - A listener to receive progress updates, or null.Throws:IOException - If the download failed to complete successfully.InterruptedException - If the download was interrupted.
-
public void cancel()
Deprecated.
Description copied from interface: Downloader
Permanently cancels the downloading by this downloader. The caller should also interrupt the downloading thread immediately after calling this method.
Once canceled, Downloader.download(com.google.android.exoplayer2.offline.Downloader.ProgressListener) cannot be called again.
Specified by:cancel in interface Downloader
-
public final void remove()
Deprecated.
Description copied from interface: Downloader
Removes the content.
Specified by:remove in interface Downloader
-
protected final[M](SegmentDownloader.html "type parameter in SegmentDownloader")getManifest([DataSource](../upstream/DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[DataSpec](../upstream/DataSpec.html "class in com.google.android.exoplayer2.upstream")dataSpec,
boolean removing)
throws[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang"),[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Loads and parses a manifest.
Parameters:dataSource - The source to use when loading the manifest.dataSpec - The manifest DataSpec.removing - Whether the manifest is being loaded as part of the download being removed.Returns:The loaded manifest.Throws:InterruptedException - If the thread on which the method is called is interrupted.IOException - If an error occurs during execution.
-
protected final <T> T execute([RunnableFutureTask](../util/RunnableFutureTask.html "class in com.google.android.exoplayer2.util")<T,?> runnable,
boolean removing)
throws[InterruptedException](https://developer.android.com/reference/java/lang/InterruptedException.html "class or interface in java.lang"),[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Executes the provided RunnableFutureTask.
Parameters:runnable - The RunnableFutureTask to execute.removing - Whether the execution is part of the download being removed.Returns:The result.Throws:InterruptedException - If the thread on which the method is called is interrupted.IOException - If an error occurs during execution.
-
protected abstract[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[SegmentDownloader.Segment](SegmentDownloader.Segment.html "class in com.google.android.exoplayer2.offline")> getSegments([DataSource](../upstream/DataSource.html "interface in com.google.android.exoplayer2.upstream")dataSource,[M](SegmentDownloader.html "type parameter in SegmentDownloader")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.
Returns a list of all downloadable SegmentDownloader.Segments for a given manifest. Any required data should be loaded using getManifest(com.google.android.exoplayer2.upstream.DataSource, com.google.android.exoplayer2.upstream.DataSpec, boolean) or execute(com.google.android.exoplayer2.util.RunnableFutureTask<T, ?>, boolean).
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
-
protected static[DataSpec](../upstream/DataSpec.html "class in com.google.android.exoplayer2.upstream")getCompressibleDataSpec([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri)
Deprecated.