MediaSource.Factory


interface MediaSource.Factory


Factory for creating MediaSources from MediaItems.

Summary

Public functions

MediaSource!

Creates a new MediaSource with the specified MediaItem.

MediaSource.Factory!
@UnstableApi
experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
)

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 set of video codecs for which within GOP sample dependency information should be parsed as part of extraction.

IntArray<Int>!

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

MediaSource.Factory!

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

MediaSource.Factory!

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

MediaSource.Factory!

Sets an optional LoadErrorHandlingPolicy.

MediaSource.Factory!

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

Constants

Public functions

createMediaSource

@UnstableApi
fun createMediaSource(mediaItem: MediaItem!): MediaSource!

Creates a new MediaSource with the specified MediaItem.

Parameters
mediaItem: MediaItem!

The media item to play.

Returns
MediaSource!

The new media source.

experimentalParseSubtitlesDuringExtraction

@UnstableApi
fun experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
): MediaSource.Factory!

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

Whether to parse subtitles during extraction or rendering.

Returns
MediaSource.Factory!

This factory, for convenience.

experimentalSetCodecsToParseWithinGopSampleDependencies

@UnstableApi
@CanIgnoreReturnValue
fun experimentalSetCodecsToParseWithinGopSampleDependencies(
    @C.VideoCodecFlags codecsToParseWithinGopSampleDependencies: Int
): MediaSource.Factory!

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 codecsToParseWithinGopSampleDependencies: Int

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

Returns
MediaSource.Factory!

This factory, for convenience.

getSupportedTypes

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

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

setCmcdConfigurationFactory

@UnstableApi
fun setCmcdConfigurationFactory(
    cmcdConfigurationFactory: CmcdConfiguration.Factory!
): MediaSource.Factory!

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

Returns
MediaSource.Factory!

This factory, for convenience.

setDrmSessionManagerProvider

@UnstableApi
fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): MediaSource.Factory!

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

Returns
MediaSource.Factory!

This factory, for convenience.

setLoadErrorHandlingPolicy

@UnstableApi
fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): MediaSource.Factory!

Sets an optional LoadErrorHandlingPolicy.

Returns
MediaSource.Factory!

This factory, for convenience.

setSubtitleParserFactory

@UnstableApi
fun setSubtitleParserFactory(subtitleParserFactory: SubtitleParser.Factory!): MediaSource.Factory!

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

Parameters
subtitleParserFactory: SubtitleParser.Factory!

The SubtitleParser.Factory for parsing subtitles during extraction.

Returns
MediaSource.Factory!

This factory, for convenience.