public static final class SingleSampleMediaSource.Factory
extends java.lang.Object
SingleSampleMediaSource.| Constructor and Description |
|---|
Factory(DataSource.Factory dataSourceFactory)
Creates a factory for
SingleSampleMediaSources. |
| Modifier and Type | Method and Description |
|---|---|
SingleSampleMediaSource |
createMediaSource(android.net.Uri uri,
Format format,
long durationUs)
Returns a new
ExtractorMediaSource using the current parameters. |
SingleSampleMediaSource |
createMediaSource(android.net.Uri uri,
Format format,
long durationUs,
android.os.Handler eventHandler,
MediaSourceEventListener eventListener)
Returns a new
SingleSampleMediaSource using the current parameters. |
SingleSampleMediaSource.Factory |
setMinLoadableRetryCount(int minLoadableRetryCount)
Sets the minimum number of times to retry if a loading error occurs.
|
SingleSampleMediaSource.Factory |
setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream)
Sets whether load errors will be treated as end-of-stream signal (load errors will not be
propagated).
|
public Factory(DataSource.Factory dataSourceFactory)
SingleSampleMediaSources.dataSourceFactory - The factory from which the DataSource to read the media will
be obtained.public SingleSampleMediaSource.Factory setMinLoadableRetryCount(int minLoadableRetryCount)
SingleSampleMediaSource.DEFAULT_MIN_LOADABLE_RETRY_COUNT.minLoadableRetryCount - The minimum number of times to retry if a loading error occurs.java.lang.IllegalStateException - If one of the create methods has already been called.public SingleSampleMediaSource.Factory setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream)
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().java.lang.IllegalStateException - If one of the create methods has already been called.public SingleSampleMediaSource createMediaSource(android.net.Uri uri, Format format, long durationUs)
ExtractorMediaSource using the current parameters. Media source events
will not be delivered.uri - The Uri.format - The Format of the media stream.durationUs - The duration of the media stream in microseconds.ExtractorMediaSource.public SingleSampleMediaSource createMediaSource(android.net.Uri uri, Format format, long durationUs, @Nullable android.os.Handler eventHandler, @Nullable MediaSourceEventListener eventListener)
SingleSampleMediaSource using the current parameters.uri - The Uri.format - The Format of the media stream.durationUs - The duration of the media stream in microseconds.eventHandler - A handler for events.eventListener - A listener of events., Format format, long durationUsSingleSampleMediaSource.