ProgressiveMediaSource.Factory


public final class ProgressiveMediaSource.Factory implements MediaSourceFactory


Factory for ProgressiveMediaSources.

Summary

Public constructors

Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for ProgressiveMediaSources.

Factory(
    DataSource.Factory dataSourceFactory,
    ExtractorsFactory extractorsFactory
)

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

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

Creates a new factory for ProgressiveMediaSources.

Factory(
    DataSource.Factory dataSourceFactory,
    ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory,
    DrmSessionManagerProvider drmSessionManagerProvider,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    int continueLoadingCheckIntervalBytes
)

Creates a new factory for ProgressiveMediaSources.

Public methods

ProgressiveMediaSource

Returns a new ProgressiveMediaSource using the current parameters.

int[]

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

ProgressiveMediaSource.Factory
@CanIgnoreReturnValue
setContinueLoadingCheckIntervalBytes(
    int continueLoadingCheckIntervalBytes
)

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 extends Executor> setDownloadExecutor(
    Supplier<T> downloadExecutor,
    Consumer<T> downloadExecutorReleaser
)

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
@CanIgnoreReturnValue
setLoadOnlySelectedTracks(boolean loadOnlySelectedTracks)

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

Inherited methods

From androidx.media3.exoplayer.source.MediaSource.Factory
MediaSource.Factory
@UnstableApi
experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)

This method is deprecated.

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

MediaSource.Factory

Sets the set of video codecs for which within GOP sample dependency information should be parsed as part of extraction.

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

public Factory(DataSource.Factory dataSourceFactory)

Creates a new factory for ProgressiveMediaSources.

The factory will use the following default components:

Parameters
DataSource.Factory dataSourceFactory

A factory for data sources to read the media.

Factory

public Factory(
    DataSource.Factory dataSourceFactory,
    ExtractorsFactory extractorsFactory
)

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

The factory will use the following default components:

Parameters
DataSource.Factory dataSourceFactory

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

public Factory(
    DataSource.Factory dataSourceFactory,
    ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory
)

Creates a new factory for ProgressiveMediaSources.

The factory will use the following default components:

Parameters
DataSource.Factory dataSourceFactory

A factory for data sources to read the media.

ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory

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

Factory

public Factory(
    DataSource.Factory dataSourceFactory,
    ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory,
    DrmSessionManagerProvider drmSessionManagerProvider,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    int continueLoadingCheckIntervalBytes
)

Creates a new factory for ProgressiveMediaSources.

Parameters
DataSource.Factory dataSourceFactory

A factory for data sources to read the media.

ProgressiveMediaExtractor.Factory progressiveMediaExtractorFactory

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.

int continueLoadingCheckIntervalBytes

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

Public methods

createMediaSource

public ProgressiveMediaSource createMediaSource(MediaItem mediaItem)

Returns a new ProgressiveMediaSource using the current parameters.

Parameters
MediaItem mediaItem

The MediaItem.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

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

setContinueLoadingCheckIntervalBytes

@CanIgnoreReturnValue
public ProgressiveMediaSource.Factory setContinueLoadingCheckIntervalBytes(
    int continueLoadingCheckIntervalBytes
)

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

Parameters
int continueLoadingCheckIntervalBytes

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

Returns
ProgressiveMediaSource.Factory

This factory, for convenience.

setDownloadExecutor

@CanIgnoreReturnValue
public MediaSource.Factory setDownloadExecutor(Supplier<ReleasableExecutor> downloadExecutor)

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

Parameters
Supplier<ReleasableExecutor> downloadExecutor

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

Returns
MediaSource.Factory

This factory, for convenience.

setDownloadExecutor

@CanIgnoreReturnValue
public ProgressiveMediaSource.Factory <T extends Executor> setDownloadExecutor(
    Supplier<T> downloadExecutor,
    Consumer<T> downloadExecutorReleaser
)

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

Parameters
Supplier<T> downloadExecutor

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

Consumer<T> downloadExecutorReleaser

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
public ProgressiveMediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

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

Returns
ProgressiveMediaSource.Factory

This factory, for convenience.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public ProgressiveMediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
ProgressiveMediaSource.Factory

This factory, for convenience.

setLoadOnlySelectedTracks

@CanIgnoreReturnValue
public ProgressiveMediaSource.Factory setLoadOnlySelectedTracks(boolean loadOnlySelectedTracks)

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

Parameters
boolean loadOnlySelectedTracks

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

Returns
ProgressiveMediaSource.Factory

This factory, for convenience.