public final class DashMediaSource extends BaseMediaSource
MediaSource
.Modifier and Type | Class and Description |
---|---|
static class |
DashMediaSource.Factory
Factory for
DashMediaSource s. |
MediaSource.MediaPeriodId, MediaSource.SourceInfoRefreshListener
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
Deprecated.
|
static long |
DEFAULT_LIVE_PRESENTATION_DELAY_MS
The default presentation delay for live streams.
|
static long |
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
Deprecated.
Use of this parameter is no longer necessary.
|
Constructor and Description |
---|
DashMediaSource(DashManifest manifest,
DashChunkSource.Factory chunkSourceFactory,
Handler eventHandler,
MediaSourceEventListener eventListener)
Deprecated.
Use
DashMediaSource.Factory instead. |
DashMediaSource(DashManifest manifest,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
Handler eventHandler,
MediaSourceEventListener eventListener)
Deprecated.
Use
DashMediaSource.Factory instead. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
DashChunkSource.Factory chunkSourceFactory,
Handler eventHandler,
MediaSourceEventListener eventListener)
Deprecated.
Use
DashMediaSource.Factory instead. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
long livePresentationDelayMs,
Handler eventHandler,
MediaSourceEventListener eventListener)
Deprecated.
Use
DashMediaSource.Factory instead. |
DashMediaSource(Uri manifestUri,
DataSource.Factory manifestDataSourceFactory,
ParsingLoadable.Parser<? extends DashManifest> manifestParser,
DashChunkSource.Factory chunkSourceFactory,
int minLoadableRetryCount,
long livePresentationDelayMs,
Handler eventHandler,
MediaSourceEventListener eventListener)
Deprecated.
Use
DashMediaSource.Factory instead. |
Modifier and Type | Method and Description |
---|---|
MediaPeriod |
createPeriod(MediaSource.MediaPeriodId periodId,
Allocator allocator,
long startPositionUs)
Returns a new
MediaPeriod identified by periodId . |
Object |
getTag()
Returns the tag set on the media source, or null if none was set.
|
void |
maybeThrowSourceInfoRefreshError()
Throws any pending error encountered while loading or refreshing source information.
|
void |
prepareSourceInternal(ExoPlayer player,
boolean isTopLevelSource,
TransferListener mediaTransferListener)
Starts source preparation.
|
void |
releasePeriod(MediaPeriod mediaPeriod)
Releases the period.
|
void |
releaseSourceInternal()
Releases the source.
|
void |
replaceManifestUri(Uri manifestUri)
Manually replaces the manifest
Uri . |
addEventListener, createEventDispatcher, createEventDispatcher, createEventDispatcher, prepareSource, prepareSource, refreshSourceInfo, releaseSource, removeEventListener
public static final long DEFAULT_LIVE_PRESENTATION_DELAY_MS
@Deprecated public static final long DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
DEFAULT_LIVE_PRESENTATION_DELAY_MS
.@Deprecated public static final long DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
@Deprecated public DashMediaSource(DashManifest manifest, DashChunkSource.Factory chunkSourceFactory, Handler eventHandler, MediaSourceEventListener eventListener)
DashMediaSource.Factory
instead.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.@Deprecated public DashMediaSource(DashManifest manifest, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, Handler eventHandler, MediaSourceEventListener eventListener)
DashMediaSource.Factory
instead.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.@Deprecated public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, DashChunkSource.Factory chunkSourceFactory, Handler eventHandler, MediaSourceEventListener eventListener)
DashMediaSource.Factory
instead.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.@Deprecated public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler, MediaSourceEventListener eventListener)
DashMediaSource.Factory
instead.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.@Deprecated public DashMediaSource(Uri manifestUri, DataSource.Factory manifestDataSourceFactory, ParsingLoadable.Parser<? extends DashManifest> manifestParser, DashChunkSource.Factory chunkSourceFactory, int minLoadableRetryCount, long livePresentationDelayMs, Handler eventHandler, MediaSourceEventListener eventListener)
DashMediaSource.Factory
instead.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
.@Nullable public Object getTag()
MediaSource
public void prepareSourceInternal(ExoPlayer player, boolean isTopLevelSource, @Nullable TransferListener mediaTransferListener)
BaseMediaSource
BaseMediaSource.releaseSourceInternal()
.prepareSourceInternal
in class BaseMediaSource
player
- 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)
.mediaTransferListener
- The transfer listener which should be informed of any media data
transfers. May be null if no listener is available. Note that this listener should usually
be only informed of transfers related to the media loads and not of auxiliary loads for
manifests and other data.public void maybeThrowSourceInfoRefreshError() throws IOException
MediaSource
Should not be called directly from application code.
IOException
public MediaPeriod createPeriod(MediaSource.MediaPeriodId periodId, Allocator allocator, long startPositionUs)
MediaSource
MediaPeriod
identified by periodId
. This method may be called
multiple times without an intervening call to MediaSource.releasePeriod(MediaPeriod)
.
Should not be called directly from application code.
periodId
- The identifier of the period.allocator
- An Allocator
from which to obtain media buffer allocations.startPositionUs
- The expected start position, in microseconds.MediaPeriod
.public void releasePeriod(MediaPeriod mediaPeriod)
MediaSource
Should not be called directly from application code.
mediaPeriod
- The period to release.public void releaseSourceInternal()
BaseMediaSource
BaseMediaSource.prepareSourceInternal(ExoPlayer, boolean, TransferListener)
.releaseSourceInternal
in class BaseMediaSource