DashMediaSource
@UnstableApi
public final class DashMediaSource extends BaseMediaSource
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.source.BaseMediaSource | |
| ↳ | androidx.media3.exoplayer.dash.DashMediaSource |
A DASH MediaSource.
Summary
Nested types |
|---|
public final class DashMediaSource.Factory implements MediaSourceFactoryFactory for |
Constants |
|
|---|---|
static final long |
The default target |
static final String |
DEFAULT_MEDIA_ID = "DashMediaSource"The media id used by media items of dash media sources without a manifest URI. |
static final long |
MIN_LIVE_DEFAULT_START_POSITION_US = 5000000The minimum default start position for live streams, in microseconds relative to the start of the live window. |
Public methods |
|
|---|---|
boolean |
canUpdateMediaItem(MediaItem mediaItem)Returns whether the |
MediaPeriod |
createPeriod(Returns a new |
synchronized MediaItem |
Returns the |
void |
Throws any pending error encountered while loading or refreshing source information. |
void |
releasePeriod(MediaPeriod mediaPeriod)Releases the period. |
void |
replaceManifestUri(Uri manifestUri)Manually replaces the manifest |
synchronized void |
updateMediaItem(MediaItem mediaItem)Updates the |
Protected methods |
|
|---|---|
void |
prepareSourceInternal(@Nullable TransferListener mediaTransferListener)Starts source preparation and enables the source, see |
void |
Releases the source, see |
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||
Constants
DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS
public static final long DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS = 30000
The default target offset for live streams that is used if no value is defined in the MediaItem or the manifest.
DEFAULT_MEDIA_ID
public static final String DEFAULT_MEDIA_ID = "DashMediaSource"
The media id used by media items of dash media sources without a manifest URI.
MIN_LIVE_DEFAULT_START_POSITION_US
public static final long MIN_LIVE_DEFAULT_START_POSITION_US = 5000000
The minimum default start position for live streams, in microseconds relative to the start of the live window.
Public methods
canUpdateMediaItem
public boolean canUpdateMediaItem(MediaItem mediaItem)
Returns whether the MediaItem for this source can be updated with the provided item.
Should not be called directly from application code.
This method must be called on the application thread.
| Returns | |
|---|---|
boolean |
Whether the source can be updated using this item. |
createPeriod
public MediaPeriod createPeriod(
MediaSource.MediaPeriodId id,
Allocator allocator,
long startPositionUs
)
Returns a new MediaPeriod identified by periodId.
Should not be called directly from application code.
This method must be called on the playback thread and only if the source is enabled.
| Parameters | |
|---|---|
MediaSource.MediaPeriodId id |
The identifier of the period. |
Allocator allocator |
An |
long startPositionUs |
The expected start position, in microseconds. |
| Returns | |
|---|---|
MediaPeriod |
A new |
getMediaItem
synchronized public MediaItem getMediaItem()
Returns the MediaItem whose media is provided by the source.
Should not be called directly from application code.
This method must be called on the application thread.
maybeThrowSourceInfoRefreshError
public void maybeThrowSourceInfoRefreshError()
Throws any pending error encountered while loading or refreshing source information.
Should not be called directly from application code.
This method must be called on the playback thread and only after prepareSource.
| Throws | |
|---|---|
java.io.IOException |
releasePeriod
public void releasePeriod(MediaPeriod mediaPeriod)
Releases the period.
Should not be called directly from application code.
This method must be called on the playback thread.
| Parameters | |
|---|---|
MediaPeriod mediaPeriod |
The period to release. |
replaceManifestUri
public void replaceManifestUri(Uri manifestUri)
Manually replaces the manifest Uri.
updateMediaItem
synchronized public void updateMediaItem(MediaItem mediaItem)
Updates the MediaItem for this source.
Should not be called directly from application code.
This method must be called on the playback thread and only if canUpdateMediaItem returns true for the new MediaItem.
Protected methods
prepareSourceInternal
protected void prepareSourceInternal(@Nullable TransferListener mediaTransferListener)
Starts source preparation and enables the source, see prepareSource. This method is called at most once until the next call to releaseSourceInternal.
This method is called on the playback thread.
| Parameters | |
|---|---|
@Nullable TransferListener 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. |
releaseSourceInternal
protected void releaseSourceInternal()
Releases the source, see releaseSource. This method is called exactly once after each call to prepareSourceInternal.
This method is called on the playback thread.