ProgressiveMediaSource.Factory


class ProgressiveMediaSource.Factory : MediaSourceFactory


Factory for ProgressiveMediaSources.

Summary

Public constructors

Factory(dataSourceFactory: DataSource.Factory!)

Creates a new factory for ProgressiveMediaSources.

Factory(
    dataSourceFactory: DataSource.Factory!,
    extractorsFactory: ExtractorsFactory!
)

Equivalent to new Factory(dataSourceFactory, () -> new BundledExtractorsAdapter(extractorsFactory).

Factory(
    dataSourceFactory: DataSource.Factory!,
    progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!
)

Creates a new factory for ProgressiveMediaSources.

Factory(
    dataSourceFactory: DataSource.Factory!,
    progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!,
    drmSessionManagerProvider: DrmSessionManagerProvider!,
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!,
    continueLoadingCheckIntervalBytes: Int
)

Creates a new factory for ProgressiveMediaSources.

Public functions

ProgressiveMediaSource!

Returns a new ProgressiveMediaSource using the current parameters.

Array<Int>!

Returns the content types supported by media sources created by this factory.

ProgressiveMediaSource.Factory!
@CanIgnoreReturnValue
setContinueLoadingCheckIntervalBytes(
    continueLoadingCheckIntervalBytes: Int
)

Sets the number of bytes that should be loaded between each invocation of onContinueLoadingRequested.

MediaSource.Factory!

Sets a supplier for an ReleasableExecutor that is used for loading the media.

ProgressiveMediaSource.Factory!
@CanIgnoreReturnValue
<T : Executor?> setDownloadExecutor(
    downloadExecutor: Supplier<T!>!,
    downloadExecutorReleaser: Consumer<T!>!
)

Sets a supplier for an Executor that is used for loading the media.

ProgressiveMediaSource.Factory!

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

ProgressiveMediaSource.Factory!

Sets an optional LoadErrorHandlingPolicy.

ProgressiveMediaSource.Factory!

Sets whether to load only the video and image tracks selected by the track selection policy.

Inherited functions

From androidx.media3.exoplayer.source.MediaSource.Factory
MediaSource.Factory!

This function is deprecated.

This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

MediaSource.Factory!

Sets the CmcdConfiguration.Factory used to obtain a CmcdConfiguration for a MediaItem.

MediaSource.Factory!

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction.

Public constructors

Factory

Factory(dataSourceFactory: DataSource.Factory!)

Creates a new factory for ProgressiveMediaSources.

The factory will use the following default components:

Parameters
dataSourceFactory: DataSource.Factory!

A factory for data sources to read the media.

Factory

Factory(
    dataSourceFactory: DataSource.Factory!,
    extractorsFactory: ExtractorsFactory!
)

Equivalent to new Factory(dataSourceFactory, () -> new BundledExtractorsAdapter(extractorsFactory).

The factory will use the following default components:

Parameters
dataSourceFactory: DataSource.Factory!

A factory for data sources to read the media.

extractorsFactory: ExtractorsFactory!

A factory for the extractors used to extract the media from its container.

Factory

Factory(
    dataSourceFactory: DataSource.Factory!,
    progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!
)

Creates a new factory for ProgressiveMediaSources.

The factory will use the following default components:

Parameters
dataSourceFactory: DataSource.Factory!

A factory for data sources to read the media.

progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!

A factory for the ProgressiveMediaExtractor to extract the media from its container.

Factory

Factory(
    dataSourceFactory: DataSource.Factory!,
    progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!,
    drmSessionManagerProvider: DrmSessionManagerProvider!,
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!,
    continueLoadingCheckIntervalBytes: Int
)

Creates a new factory for ProgressiveMediaSources.

Parameters
dataSourceFactory: DataSource.Factory!

A factory for data sources to read the media.

progressiveMediaExtractorFactory: ProgressiveMediaExtractor.Factory!

A factory for the ProgressiveMediaExtractor to extract media from its container.

drmSessionManagerProvider: DrmSessionManagerProvider!

A provider to obtain a DrmSessionManager for a MediaItem.

loadErrorHandlingPolicy: LoadErrorHandlingPolicy!

A policy to handle load error.

continueLoadingCheckIntervalBytes: Int

The number of bytes that should be loaded between each invocation of onContinueLoadingRequested.

Public functions

createMediaSource

fun createMediaSource(mediaItem: MediaItem!): ProgressiveMediaSource!

Returns a new ProgressiveMediaSource using the current parameters.

Parameters
mediaItem: MediaItem!

The MediaItem.

getSupportedTypes

@C.ContentType
fun getSupportedTypes(): Array<Int>!

Returns the content types supported by media sources created by this factory.

setContinueLoadingCheckIntervalBytes

@CanIgnoreReturnValue
fun setContinueLoadingCheckIntervalBytes(
    continueLoadingCheckIntervalBytes: Int
): ProgressiveMediaSource.Factory!

Sets the number of bytes that should be loaded between each invocation of onContinueLoadingRequested. The default value is DEFAULT_LOADING_CHECK_INTERVAL_BYTES.

Parameters
continueLoadingCheckIntervalBytes: Int

The number of bytes that should be loaded between each invocation of onContinueLoadingRequested.

Returns
ProgressiveMediaSource.Factory!

This factory, for convenience.

setDownloadExecutor

@CanIgnoreReturnValue
fun setDownloadExecutor(downloadExecutor: Supplier<ReleasableExecutor!>!): MediaSource.Factory!

Sets a supplier for an ReleasableExecutor that is used for loading the media.

Parameters
downloadExecutor: Supplier<ReleasableExecutor!>!

A Supplier that provides an externally managed ReleasableExecutor for downloading and extraction.

Returns
MediaSource.Factory!

This factory, for convenience.

setDownloadExecutor

@CanIgnoreReturnValue
fun <T : Executor?> setDownloadExecutor(
    downloadExecutor: Supplier<T!>!,
    downloadExecutorReleaser: Consumer<T!>!
): ProgressiveMediaSource.Factory!

Sets a supplier for an Executor that is used for loading the media.

Parameters
downloadExecutor: Supplier<T!>!

A Supplier that provides an externally managed Executor for downloading and extraction.

downloadExecutorReleaser: Consumer<T!>!

A callback triggered once a load task is finished and a supplied executor is no longer required.

Returns
ProgressiveMediaSource.Factory!

This factory, for convenience.

setDrmSessionManagerProvider

@CanIgnoreReturnValue
fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): ProgressiveMediaSource.Factory!

Sets the DrmSessionManagerProvider used to obtain a DrmSessionManager for a MediaItem.

Returns
ProgressiveMediaSource.Factory!

This factory, for convenience.

setLoadErrorHandlingPolicy

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

Sets an optional LoadErrorHandlingPolicy.

Returns
ProgressiveMediaSource.Factory!

This factory, for convenience.

setLoadOnlySelectedTracks

@CanIgnoreReturnValue
fun setLoadOnlySelectedTracks(loadOnlySelectedTracks: Boolean): ProgressiveMediaSource.Factory!

Sets whether to load only the video and image tracks selected by the track selection policy.

Audio, text, and metadata tracks are always loaded regardless of track selection, as they have relatively low bitrate and are more likely to be toggled mid-playback (e.g., changing audio languages or subtitle tracks, or disabling audio during scrubbing mode). Always loading them allows seamlessly switching mid-playback without re-buffering or seeking.

Note that while this saves memory, it may cause additional buffering or latency if unselected video or image tracks are enabled mid-playback, as the player may need to perform additional network requests to fetch the newly selected track data.

The default is true.

Parameters
loadOnlySelectedTracks: Boolean

Whether to load only the video and image tracks selected by the track selection policy, instead of loading all tracks.

Returns
ProgressiveMediaSource.Factory!

This factory, for convenience.