public final class SingleSampleMediaSource extends BaseMediaSource
Uri as a single sample belonging to a single MediaPeriod.| Modifier and Type | Class and Description |
|---|---|
static interface |
SingleSampleMediaSource.EventListener
Deprecated.
|
static class |
SingleSampleMediaSource.Factory
Factory for
SingleSampleMediaSource. |
MediaSource.MediaPeriodId, MediaSource.SourceInfoRefreshListener| Constructor and Description |
|---|
SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs)
Deprecated.
Use
SingleSampleMediaSource.Factory instead. |
SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount)
Deprecated.
Use
SingleSampleMediaSource.Factory instead. |
SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount,
android.os.Handler eventHandler,
SingleSampleMediaSource.EventListener eventListener,
int eventSourceId,
boolean treatLoadErrorsAsEndOfStream)
Deprecated.
Use
SingleSampleMediaSource.Factory instead. |
| Modifier and Type | Method and Description |
|---|---|
MediaPeriod |
createPeriod(MediaSource.MediaPeriodId id,
Allocator allocator,
long startPositionUs)
Returns a new
MediaPeriod identified by periodId. |
java.lang.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(TransferListener mediaTransferListener)
Starts source preparation.
|
void |
releasePeriod(MediaPeriod mediaPeriod)
Releases the period.
|
void |
releaseSourceInternal()
Releases the source.
|
addEventListener, createEventDispatcher, createEventDispatcher, createEventDispatcher, prepareSource, refreshSourceInfo, releaseSource, removeEventListener@Deprecated
public SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs)
SingleSampleMediaSource.Factory instead.uri - The Uri of the media stream.dataSourceFactory - The factory from which the DataSource to read the media will
be obtained.format - The Format associated with the output track.durationUs - The duration of the media stream in microseconds.@Deprecated
public SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount)
SingleSampleMediaSource.Factory instead.uri - The Uri of the media stream.dataSourceFactory - The factory from which the DataSource to read the media will
be obtained.format - The Format associated with the output track.durationUs - The duration of the media stream in microseconds.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.@Deprecated
public SingleSampleMediaSource(android.net.Uri uri,
DataSource.Factory dataSourceFactory,
Format format,
long durationUs,
int minLoadableRetryCount,
android.os.Handler eventHandler,
SingleSampleMediaSource.EventListener eventListener,
int eventSourceId,
boolean treatLoadErrorsAsEndOfStream)
SingleSampleMediaSource.Factory instead.uri - The Uri of the media stream.dataSourceFactory - The factory from which the DataSource to read the media will
be obtained.format - The Format associated with the output track.durationUs - The duration of the media stream in microseconds.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.eventSourceId - An identifier that gets passed to eventListener methods.treatLoadErrorsAsEndOfStream - If true, load errors will not be propagated by sample
streams, treating them as ended instead. If false, load errors will be propagated normally
by SampleStream.maybeThrowError().@Nullable public java.lang.Object getTag()
MediaSourcepublic void prepareSourceInternal(@Nullable
TransferListener mediaTransferListener)
BaseMediaSourceBaseMediaSource.releaseSourceInternal().prepareSourceInternal in class BaseMediaSourcemediaTransferListener - 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 java.io.IOException
MediaSourceShould not be called directly from application code.
java.io.IOExceptionpublic MediaPeriod createPeriod(MediaSource.MediaPeriodId id, Allocator allocator, long startPositionUs)
MediaSourceMediaPeriod 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.
id - 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)
MediaSourceShould not be called directly from application code.
mediaPeriod - The period to release.public void releaseSourceInternal()
BaseMediaSourceBaseMediaSource.prepareSourceInternal(TransferListener).releaseSourceInternal in class BaseMediaSource