SingleSampleMediaSource
@UnstableApi
public final class SingleSampleMediaSource extends BaseMediaSource
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.source.BaseMediaSource | |
| ↳ | androidx.media3.exoplayer.source.SingleSampleMediaSource |
Summary
Nested types |
|---|
public final class SingleSampleMediaSource.FactoryFactory for |
Public methods |
|
|---|---|
MediaPeriod |
Returns a new |
MediaItem |
Returns the |
void |
Throws any pending error encountered while loading or refreshing source information. |
void |
Releases the period. |
Protected methods |
|
|---|---|
void |
Starts source preparation and enables the source, see |
void |
Releases the source, see |
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Public methods
createPeriod
public MediaPeriodcreatePeriod(
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
public MediaItemgetMediaItem()
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.
releasePeriod
public voidreleasePeriod(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. |
Protected methods
prepareSourceInternal
protected voidprepareSourceInternal(@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.