Back to Exoplayer

SingleSampleMediaSource.Factory (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/source/SingleSampleMediaSource.Factory.html

latest7.5 KB
Original Source

Package com.google.android.exoplayer2.source

Class SingleSampleMediaSource.Factory


public static final classSingleSampleMediaSource.Factoryextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Factory for SingleSampleMediaSource.

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | Factory​(DataSource.Factory dataSourceFactory) | Creates a factory for SingleSampleMediaSources. |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | SingleSampleMediaSource | createMediaSource​(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs) | Returns a new SingleSampleMediaSource using the current parameters. | | SingleSampleMediaSource.Factory | setLoadErrorHandlingPolicy​(LoadErrorHandlingPolicy loadErrorHandlingPolicy) | Sets the LoadErrorHandlingPolicy. | | SingleSampleMediaSource.Factory | setTag​(Object tag) | Sets a tag for the media source which will be published in the Timeline of the source as Window#mediaItem.localConfiguration.tag. | | SingleSampleMediaSource.Factory | setTrackId​(String trackId) | Deprecated. Use MediaItem.SubtitleConfiguration.Builder.setId(String) instead (on the MediaItem.SubtitleConfiguration passed to createMediaSource(MediaItem.SubtitleConfiguration, long)).

| | SingleSampleMediaSource.Factory | setTreatLoadErrorsAsEndOfStream​(boolean treatLoadErrorsAsEndOfStream) | Sets whether load errors will be treated as end-of-stream signal (load errors will not be propagated). |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

Factory

public Factory​([DataSource.Factory](../upstream/DataSource.Factory.html "interface in com.google.android.exoplayer2.upstream")dataSourceFactory)

Creates a factory for SingleSampleMediaSources. Parameters:dataSourceFactory - The factory from which the DataSource to read the media will be obtained.

Method Detail

- 

setTag

@CanIgnoreReturnValue
public[SingleSampleMediaSource.Factory](SingleSampleMediaSource.Factory.html "class in com.google.android.exoplayer2.source")setTag​(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")tag)

Sets a tag for the media source which will be published in the Timeline of the source as Window#mediaItem.localConfiguration.tag. Parameters:tag - A tag for the media source.Returns:This factory, for convenience.

- 

setTrackId

@CanIgnoreReturnValue[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public[SingleSampleMediaSource.Factory](SingleSampleMediaSource.Factory.html "class in com.google.android.exoplayer2.source")setTrackId​(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")trackId)

Deprecated. Use MediaItem.SubtitleConfiguration.Builder.setId(String) instead (on the MediaItem.SubtitleConfiguration passed to createMediaSource(MediaItem.SubtitleConfiguration, long)). trackId will only be used if MediaItem.SubtitleConfiguration.id is null.

- 

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public[SingleSampleMediaSource.Factory](SingleSampleMediaSource.Factory.html "class in com.google.android.exoplayer2.source")setLoadErrorHandlingPolicy​(@Nullable[LoadErrorHandlingPolicy](../upstream/LoadErrorHandlingPolicy.html "interface in com.google.android.exoplayer2.upstream")loadErrorHandlingPolicy)

Sets the LoadErrorHandlingPolicy. The default value is created by calling DefaultLoadErrorHandlingPolicy(). Parameters:loadErrorHandlingPolicy - A LoadErrorHandlingPolicy.Returns:This factory, for convenience.

- 

setTreatLoadErrorsAsEndOfStream

@CanIgnoreReturnValue
public[SingleSampleMediaSource.Factory](SingleSampleMediaSource.Factory.html "class in com.google.android.exoplayer2.source")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 by SampleStream.maybeThrowError().Returns:This factory, for convenience.

- 

createMediaSource

public[SingleSampleMediaSource](SingleSampleMediaSource.html "class in com.google.android.exoplayer2.source")createMediaSource​([MediaItem.SubtitleConfiguration](../MediaItem.SubtitleConfiguration.html "class in com.google.android.exoplayer2")subtitleConfiguration,
                                                 long durationUs)

Returns a new SingleSampleMediaSource using the current parameters. Parameters:subtitleConfiguration - The MediaItem.SubtitleConfiguration.durationUs - The duration of the media stream in microseconds.Returns:The new SingleSampleMediaSource.