ForwardingMediaSourceFactory


@UnstableApi
public class ForwardingMediaSourceFactory implements MediaSource.Factory


A forwarding MediaSource.Factory that forwards all methods to the underlying implementation.

Summary

Public constructors

Creates a forwarding MediaSource.Factory.

Public methods

MediaSource

Creates a new MediaSource with the specified MediaItem.

MediaSource.Factory
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
experimentalSetCodecsToParseWithinGopSampleDependencies(
    @C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies
)

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

int[]

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

MediaSource.Factory
setCmcdConfigurationFactory(
    CmcdConfiguration.Factory cmcdConfigurationFactory
)

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

MediaSource.Factory

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

MediaSource.Factory
setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

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

MediaSource.Factory
setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

MediaSource.Factory

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

Public constructors

ForwardingMediaSourceFactory

public ForwardingMediaSourceFactory(MediaSource.Factory factory)

Creates a forwarding MediaSource.Factory.

Parameters
MediaSource.Factory factory

The MediaSource.Factory to forward to.

Public methods

createMediaSource

public MediaSource createMediaSource(MediaItem mediaItem)

Creates a new MediaSource with the specified MediaItem.

Parameters
MediaItem mediaItem

The media item to play.

Returns
MediaSource

The new media source.

experimentalParseSubtitlesDuringExtraction

public MediaSource.Factory experimentalParseSubtitlesDuringExtraction(
    boolean parseSubtitlesDuringExtraction
)

Sets whether subtitles should be parsed as part of extraction (before being added to the sample queue) or as part of rendering (when being taken from the sample queue). Defaults to true (i.e. subtitles will be parsed during extraction).

This method is experimental and will be renamed or removed in a future release.

Parameters
boolean parseSubtitlesDuringExtraction

Whether to parse subtitles during extraction or rendering.

Returns
MediaSource.Factory

This factory, for convenience.

experimentalSetCodecsToParseWithinGopSampleDependencies

public MediaSource.Factory experimentalSetCodecsToParseWithinGopSampleDependencies(
    @C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies
)

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

Having access to additional sample dependency information can speed up seeking. See FLAG_READ_WITHIN_GOP_SAMPLE_DEPENDENCIES.

This method is experimental and will be renamed or removed in a future release.

Parameters
@C.VideoCodecFlags int codecsToParseWithinGopSampleDependencies

The set of codecs for which to parse within GOP sample dependency information.

Returns
MediaSource.Factory

This factory, for convenience.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

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

setCmcdConfigurationFactory

public MediaSource.Factory setCmcdConfigurationFactory(
    CmcdConfiguration.Factory cmcdConfigurationFactory
)

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

Returns
MediaSource.Factory

This factory, for convenience.

setDownloadExecutor

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.

setDrmSessionManagerProvider

public MediaSource.Factory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

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

Returns
MediaSource.Factory

This factory, for convenience.

setLoadErrorHandlingPolicy

public MediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
MediaSource.Factory

This factory, for convenience.

setSubtitleParserFactory

public MediaSource.Factory setSubtitleParserFactory(SubtitleParser.Factory subtitleParserFactory)

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

Parameters
SubtitleParser.Factory subtitleParserFactory

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
MediaSource.Factory

This factory, for convenience.