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)
Deprecated.
|
SingleSampleMediaSource.Factory |
setMinLoadableRetryCount(int minLoadableRetryCount)
Sets the minimum number of times to retry if a loading error occurs.
|
SingleSampleMediaSource.Factory |
setTag(java.lang.Object tag)
Sets a tag for the media source which will be published in the
Timeline of the source
as Timeline.Window#tag. |
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 setTag(java.lang.Object tag)
Timeline of the source
as Timeline.Window#tag.tag - A tag for the media source.java.lang.IllegalStateException - If one of the create methods has already been called.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.uri - The Uri.format - The Format of the media stream.durationUs - The duration of the media stream in microseconds.ExtractorMediaSource.@Deprecated public SingleSampleMediaSource createMediaSource(android.net.Uri uri, Format format, long durationUs, @Nullable android.os.Handler eventHandler, @Nullable MediaSourceEventListener eventListener)
createMediaSource(Uri, Format, long) and BaseMediaSource.addEventListener(Handler, MediaSourceEventListener) instead.