SingleSampleMediaSource.Factory


class SingleSampleMediaSource.Factory


Factory for SingleSampleMediaSource.

Summary

Public constructors

Factory(dataSourceFactory: DataSource.Factory!)

Creates a factory for SingleSampleMediaSources.

Public functions

SingleSampleMediaSource!
createMediaSource(
    subtitleConfiguration: MediaItem.SubtitleConfiguration!,
    durationUs: Long
)

Returns a new SingleSampleMediaSource using the current parameters.

SingleSampleMediaSource.Factory!

Sets the LoadErrorHandlingPolicy.

SingleSampleMediaSource.Factory!

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

SingleSampleMediaSource.Factory!

This function is deprecated.

Use setId instead (on the MediaItem.SubtitleConfiguration passed to createMediaSource).

SingleSampleMediaSource.Factory!

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

Public constructors

Factory

Factory(dataSourceFactory: DataSource.Factory!)

Creates a factory for SingleSampleMediaSources.

Parameters
dataSourceFactory: DataSource.Factory!

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

Public functions

createMediaSource

fun createMediaSource(
    subtitleConfiguration: MediaItem.SubtitleConfiguration!,
    durationUs: Long
): SingleSampleMediaSource!

Returns a new SingleSampleMediaSource using the current parameters.

Parameters
subtitleConfiguration: MediaItem.SubtitleConfiguration!

The MediaItem.SubtitleConfiguration.

durationUs: Long

The duration of the media stream in microseconds.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy?
): SingleSampleMediaSource.Factory!

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

Parameters
loadErrorHandlingPolicy: LoadErrorHandlingPolicy?

A LoadErrorHandlingPolicy.

Returns
SingleSampleMediaSource.Factory!

This factory, for convenience.

setTag

@CanIgnoreReturnValue
fun setTag(tag: Any?): SingleSampleMediaSource.Factory!

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

Parameters
tag: Any?

A tag for the media source.

Returns
SingleSampleMediaSource.Factory!

This factory, for convenience.

setTrackId

@CanIgnoreReturnValue
fun setTrackId(trackId: String?): SingleSampleMediaSource.Factory!

setTreatLoadErrorsAsEndOfStream

@CanIgnoreReturnValue
fun setTreatLoadErrorsAsEndOfStream(treatLoadErrorsAsEndOfStream: Boolean): SingleSampleMediaSource.Factory!

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: Boolean

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

Returns
SingleSampleMediaSource.Factory!

This factory, for convenience.