Class SingleSampleMediaSource.Factory
- java.lang.Object
-
- com.google.android.exoplayer2.source.SingleSampleMediaSource.Factory
-
- Enclosing class:
- SingleSampleMediaSource
public static final class SingleSampleMediaSource.Factory extends Object
Factory forSingleSampleMediaSource
.
-
-
Constructor Summary
Constructors Constructor Description Factory(DataSource.Factory dataSourceFactory)
Creates a factory forSingleSampleMediaSource
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SingleSampleMediaSource
createMediaSource(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs)
Returns a newSingleSampleMediaSource
using the current parameters.SingleSampleMediaSource.Factory
setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets theLoadErrorHandlingPolicy
.SingleSampleMediaSource.Factory
setTag(Object tag)
Sets a tag for the media source which will be published in theTimeline
of the source asWindow#mediaItem.localConfiguration.tag
.SingleSampleMediaSource.Factory
setTrackId(String trackId)
Deprecated.SingleSampleMediaSource.Factory
setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream)
Sets whether load errors will be treated as end-of-stream signal (load errors will not be propagated).
-
-
-
Constructor Detail
-
Factory
public Factory(DataSource.Factory dataSourceFactory)
Creates a factory forSingleSampleMediaSource
s.- Parameters:
dataSourceFactory
- The factory from which theDataSource
to read the media will be obtained.
-
-
Method Detail
-
setTag
@CanIgnoreReturnValue public SingleSampleMediaSource.Factory setTag(@Nullable Object tag)
Sets a tag for the media source which will be published in theTimeline
of the source asWindow#mediaItem.localConfiguration.tag
.- Parameters:
tag
- A tag for the media source.- Returns:
- This factory, for convenience.
-
setTrackId
@CanIgnoreReturnValue @Deprecated public SingleSampleMediaSource.Factory setTrackId(@Nullable String trackId)
Deprecated.UseMediaItem.SubtitleConfiguration.Builder.setId(String)
instead (on theMediaItem.SubtitleConfiguration
passed tocreateMediaSource(MediaItem.SubtitleConfiguration, long)
).trackId
will only be used ifMediaItem.SubtitleConfiguration.id
isnull
.
-
setLoadErrorHandlingPolicy
@CanIgnoreReturnValue public SingleSampleMediaSource.Factory setLoadErrorHandlingPolicy(@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy)
Sets theLoadErrorHandlingPolicy
. The default value is created by callingDefaultLoadErrorHandlingPolicy()
.- Parameters:
loadErrorHandlingPolicy
- ALoadErrorHandlingPolicy
.- Returns:
- This factory, for convenience.
-
setTreatLoadErrorsAsEndOfStream
@CanIgnoreReturnValue public SingleSampleMediaSource.Factory setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream)
Sets whether load errors will be treated as end-of-stream signal (load errors will not be propagated). The default value is true.- Parameters:
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 bySampleStream.maybeThrowError()
.- Returns:
- This factory, for convenience.
-
createMediaSource
public SingleSampleMediaSource createMediaSource(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs)
Returns a newSingleSampleMediaSource
using the current parameters.- Parameters:
subtitleConfiguration
- TheMediaItem.SubtitleConfiguration
.durationUs
- The duration of the media stream in microseconds.- Returns:
- The new
SingleSampleMediaSource
.
-
-