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 forSingleSampleMediaSources.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SingleSampleMediaSourcecreateMediaSource(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs)Returns a newSingleSampleMediaSourceusing the current parameters.SingleSampleMediaSource.FactorysetLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)Sets theLoadErrorHandlingPolicy.SingleSampleMediaSource.FactorysetTag(Object tag)Sets a tag for the media source which will be published in theTimelineof the source asWindow#mediaItem.localConfiguration.tag.SingleSampleMediaSource.FactorysetTrackId(String trackId)Deprecated.SingleSampleMediaSource.FactorysetTreatLoadErrorsAsEndOfStream(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 forSingleSampleMediaSources.- Parameters:
dataSourceFactory- The factory from which theDataSourceto 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 theTimelineof 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.SubtitleConfigurationpassed tocreateMediaSource(MediaItem.SubtitleConfiguration, long)).trackIdwill only be used ifMediaItem.SubtitleConfiguration.idisnull.
-
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 newSingleSampleMediaSourceusing the current parameters.- Parameters:
subtitleConfiguration- TheMediaItem.SubtitleConfiguration.durationUs- The duration of the media stream in microseconds.- Returns:
- The new
SingleSampleMediaSource.
-
-