public static final class SingleSampleMediaSource.Factory extends Object
SingleSampleMediaSource
.Constructor and Description |
---|
Factory(DataSource.Factory dataSourceFactory)
Creates a factory for
SingleSampleMediaSource s. |
Modifier and Type | Method and Description |
---|---|
SingleSampleMediaSource |
createMediaSource(Uri uri,
Format format,
long durationUs)
Returns a new
ExtractorMediaSource using the current parameters. |
SingleSampleMediaSource |
createMediaSource(Uri uri,
Format format,
long durationUs,
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(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)
SingleSampleMediaSource
s.dataSourceFactory
- The factory from which the DataSource
to read the media will
be obtained.public SingleSampleMediaSource.Factory setTag(Object tag)
Timeline
of the source
as Timeline.Window#tag
.tag
- A tag for the media source.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.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
.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()
.IllegalStateException
- If one of the create
methods has already been called.public SingleSampleMediaSource createMediaSource(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(Uri uri, Format format, long durationUs, @Nullable Handler eventHandler, @Nullable MediaSourceEventListener eventListener)
createMediaSource(Uri, Format, long)
and BaseMediaSource.addEventListener(Handler, MediaSourceEventListener)
instead.