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.

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.

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.