public final class

SingleSampleMediaSource.Factory

extends java.lang.Object

 java.lang.Object

↳androidx.media3.exoplayer.source.SingleSampleMediaSource.Factory

Overview

Factory for SingleSampleMediaSource.

Summary

Constructors
publicFactory(DataSource.Factory dataSourceFactory)

Creates a factory for SingleSampleMediaSources.

Methods
public SingleSampleMediaSourcecreateMediaSource(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs)

Returns a new SingleSampleMediaSource using the current parameters.

public SingleSampleMediaSource.FactorysetLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

Sets the LoadErrorHandlingPolicy.

public SingleSampleMediaSource.FactorysetTag(java.lang.Object tag)

Sets a tag for the media source which will be published in the Timeline of the source as .

public SingleSampleMediaSource.FactorysetTrackId(java.lang.String trackId)

public SingleSampleMediaSource.FactorysetTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream)

Sets whether load errors will be treated as end-of-stream signal (load errors will not be propagated).

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Factory(DataSource.Factory dataSourceFactory)

Creates a factory for SingleSampleMediaSources.

Parameters:

dataSourceFactory: The factory from which the DataSource to read the media will be obtained.

Methods

public 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 .

Parameters:

tag: A tag for the media source.

Returns:

This factory, for convenience.

public SingleSampleMediaSource.Factory setTrackId(java.lang.String trackId)

Deprecated: Use instead (on the passed to SingleSampleMediaSource.Factory.createMediaSource(MediaItem.SubtitleConfiguration, long)). trackId will only be used if is null.

public SingleSampleMediaSource.Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy)

Sets the LoadErrorHandlingPolicy. The default value is created by calling DefaultLoadErrorHandlingPolicy.DefaultLoadErrorHandlingPolicy().

Parameters:

loadErrorHandlingPolicy: A LoadErrorHandlingPolicy.

Returns:

This factory, for convenience.

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 by SampleStream.maybeThrowError().

Returns:

This factory, for convenience.

public SingleSampleMediaSource createMediaSource(MediaItem.SubtitleConfiguration subtitleConfiguration, long durationUs)

Returns a new SingleSampleMediaSource using the current parameters.

Parameters:

subtitleConfiguration: The .
durationUs: The duration of the media stream in microseconds.

Returns:

The new SingleSampleMediaSource.