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 |
setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets the
LoadErrorHandlingPolicy. |
SingleSampleMediaSource.Factory |
setMinLoadableRetryCount(int minLoadableRetryCount)
Deprecated.
Use
setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy) instead. |
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.@Deprecated public SingleSampleMediaSource.Factory setMinLoadableRetryCount(int minLoadableRetryCount)
setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy) instead.setLoadErrorHandlingPolicy(com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy) for the default value.
Calling this method is equivalent to calling setLoadErrorHandlingPolicy(com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy) with
DefaultLoadErrorHandlingPolicy(minLoadableRetryCount)
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 setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
LoadErrorHandlingPolicy. The default value is created by calling DefaultLoadErrorHandlingPolicy.DefaultLoadErrorHandlingPolicy().
Calling this method overrides any calls to setMinLoadableRetryCount(int).
loadErrorHandlingPolicy - A LoadErrorHandlingPolicy.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.