public final class DashMediaSource extends Object implements MediaSource
MediaSource.MediaSource.Listener, MediaSource.MediaPeriodId| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
A fixed default presentation delay for live streams.
|
static long |
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
A constant indicating that the presentation delay for live streams should be set to
DashManifest.suggestedPresentationDelay if specified by the manifest, or
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS otherwise. |
static int |
DEFAULT_MIN_LOADABLE_RETRY_COUNT
The default minimum number of times to retry loading data prior to failing.
|
| Constructor and Description |
|---|
DashMediaSource(DashManifest manifest,
DashChunkSource.Factory chunkSourceFactory,
Handler eventHandler,
AdaptiveMediaSourceEventListener eventListener)
Constructs an instance to play a given
DashManifest, which must be static. |
DashMediaSource(DashManifest manifest,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
Handler eventHandler,
AdaptiveMediaSourceEventListener eventListener)
Constructs an instance to play a given
DashManifest, which must be static. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
DashChunkSource.Factory chunkSourceFactory,
Handler eventHandler,
AdaptiveMediaSourceEventListener eventListener)
Constructs an instance to play the manifest at a given
Uri, which may be dynamic or
static. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
long livePresentationDelayMs,
Handler eventHandler,
AdaptiveMediaSourceEventListener eventListener)
Constructs an instance to play the manifest at a given
Uri, which may be dynamic or
static. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
ParsingLoadable.Parser<? extends DashManifest> manifestParser,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
long livePresentationDelayMs,
Handler eventHandler,
AdaptiveMediaSourceEventListener eventListener)
Constructs an instance to play the manifest at a given
Uri, which may be dynamic or
static. |
| Modifier and Type | Method and Description |
|---|---|
MediaPeriod |
createPeriod(MediaSource.MediaPeriodId periodId,
Allocator allocator)
Returns a new
MediaPeriod identified by periodId. |
void |
maybeThrowSourceInfoRefreshError()
Throws any pending error encountered while loading or refreshing source information.
|
void |
prepareSource(ExoPlayer player,
boolean isTopLevelSource,
MediaSource.Listener listener)
Starts preparation of the source.
|
void |
releasePeriod(MediaPeriod mediaPeriod)
Releases the period.
|
void |
releaseSource()
Releases the source.
|
void |
replaceManifestUri(Uri manifestUri)
Manually replaces the manifest
Uri. |
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT
public static final long DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
DashManifest.suggestedPresentationDelay if specified by the manifest, or
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS otherwise. The presentation delay is the
duration by which the default start position precedes the end of the live window.public static final long DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
public DashMediaSource(DashManifest manifest, DashChunkSource.Factory chunkSourceFactory, Handler eventHandler, AdaptiveMediaSourceEventListener eventListener)
DashManifest, which must be static.manifest - The manifest. DashManifest.dynamic must be false.chunkSourceFactory - A factory for DashChunkSource instances.eventHandler - A handler for events. May be null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.public DashMediaSource(DashManifest manifest, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, Handler eventHandler, AdaptiveMediaSourceEventListener eventListener)
DashManifest, which must be static.manifest - The manifest. DashManifest.dynamic must be false.chunkSourceFactory - A factory for DashChunkSource instances.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.eventHandler - A handler for events. May be null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, DashChunkSource.Factory chunkSourceFactory, Handler eventHandler, AdaptiveMediaSourceEventListener eventListener)
Uri, which may be dynamic or
static.manifestUri - The manifest Uri.manifestDataSourceFactory - A factory for DataSource instances that will be used
to load (and refresh) the manifest.chunkSourceFactory - A factory for DashChunkSource instances.eventHandler - A handler for events. May be null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler, AdaptiveMediaSourceEventListener eventListener)
Uri, which may be dynamic or
static.manifestUri - The manifest Uri.manifestDataSourceFactory - A factory for DataSource instances that will be used
to load (and refresh) the manifest.chunkSourceFactory - A factory for DashChunkSource instances.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.livePresentationDelayMs - For live playbacks, the duration in milliseconds by which the
default start position should precede the end of the live window. Use
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS to use the value specified by
the manifest, if present.eventHandler - A handler for events. May be null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, ParsingLoadable.Parser<? extends DashManifest> manifestParser, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler, AdaptiveMediaSourceEventListener eventListener)
Uri, which may be dynamic or
static.manifestUri - The manifest Uri.manifestDataSourceFactory - A factory for DataSource instances that will be used
to load (and refresh) the manifest.manifestParser - A parser for loaded manifest data.chunkSourceFactory - A factory for DashChunkSource instances.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.livePresentationDelayMs - For live playbacks, the duration in milliseconds by which the
default start position should precede the end of the live window. Use
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS to use the value specified by
the manifest, if present.eventHandler - A handler for events. May be null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.public void replaceManifestUri(Uri manifestUri)
Uri.manifestUri - The replacement manifest Uri.public void prepareSource(ExoPlayer player, boolean isTopLevelSource, MediaSource.Listener listener)
MediaSourceprepareSource in interface MediaSourceplayer - The player for which this source is being prepared.isTopLevelSource - Whether this source has been passed directly to
ExoPlayer.prepare(MediaSource) or
ExoPlayer.prepare(MediaSource, boolean, boolean). If false, this source is
being prepared by another source (e.g. ConcatenatingMediaSource) for composition.listener - The listener for source events.public void maybeThrowSourceInfoRefreshError()
throws IOException
MediaSourcemaybeThrowSourceInfoRefreshError in interface MediaSourceIOExceptionpublic MediaPeriod createPeriod(MediaSource.MediaPeriodId periodId, Allocator allocator)
MediaSourceMediaPeriod identified by periodId. This method may be called
multiple times with the same period identifier without an intervening call to
MediaSource.releasePeriod(MediaPeriod).createPeriod in interface MediaSourceperiodId - The identifier of the period.allocator - An Allocator from which to obtain media buffer allocations.MediaPeriod.public void releasePeriod(MediaPeriod mediaPeriod)
MediaSourcereleasePeriod in interface MediaSourcemediaPeriod - The period to release.public void releaseSource()
MediaSourceThis method should be called when the source is no longer required. It may be called in any state.
releaseSource in interface MediaSource