public final class SingleSampleMediaSource extends java.lang.Object implements MediaSource
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.Listener, MediaSource.MediaPeriodId| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MIN_LOADABLE_RETRY_COUNT
The default minimum number of times to retry loading data prior to failing.
|
MEDIA_SOURCE_REUSED_ERROR_MESSAGE| 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)
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.
|
public static final int DEFAULT_MIN_LOADABLE_RETRY_COUNT
@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().public void prepareSource(ExoPlayer player, boolean isTopLevelSource, MediaSource.Listener listener)
MediaSourceShould not be called directly from application code.
prepareSource 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 java.io.IOException
MediaSourceShould not be called directly from application code.
maybeThrowSourceInfoRefreshError in interface MediaSourcejava.io.IOExceptionpublic MediaPeriod createPeriod(MediaSource.MediaPeriodId id, 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).
Should not be called directly from application code.
createPeriod in interface MediaSourceid - The identifier of the period.allocator - An Allocator from which to obtain media buffer allocations.MediaPeriod.public void releasePeriod(MediaPeriod mediaPeriod)
MediaSourceShould not be called directly from application code.
releasePeriod in interface MediaSourcemediaPeriod - The period to release.public void releaseSource()
MediaSourceShould not be called directly from application code.
releaseSource in interface MediaSource