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.

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.

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