PreloadMediaSource.Factory


class PreloadMediaSource.Factory : MediaSource.Factory


Factory for PreloadMediaSource.

Summary

Public constructors

Factory(
    mediaSourceFactory: MediaSource.Factory!,
    preloadControl: PreloadMediaSource.PreloadControl!,
    trackSelector: TrackSelector!,
    bandwidthMeter: BandwidthMeter!,
    rendererCapabilities: Array<RendererCapabilities!>!,
    allocator: Allocator!,
    preloadLooper: Looper!
)

Creates a new factory for PreloadMediaSource.

Public functions

PreloadMediaSource!

Creates a new MediaSource with the specified MediaItem.

PreloadMediaSource!
IntArray<Int>!

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

PreloadMediaSource.Factory!
setCmcdConfigurationFactory(
    cmcdConfigurationFactory: CmcdConfiguration.Factory!
)

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

PreloadMediaSource.Factory!
setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
)

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

PreloadMediaSource.Factory!
setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
)

Sets an optional LoadErrorHandlingPolicy.

Inherited functions

From androidx.media3.exoplayer.source.MediaSource.Factory
MediaSource.Factory!
@UnstableApi
experimentalParseSubtitlesDuringExtraction(
    parseSubtitlesDuringExtraction: Boolean
)

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

MediaSource.Factory!

Sets the SubtitleParser.Factory to be used for parsing subtitles during extraction if experimentalParseSubtitlesDuringExtraction is enabled.

Public constructors

Factory

Factory(
    mediaSourceFactory: MediaSource.Factory!,
    preloadControl: PreloadMediaSource.PreloadControl!,
    trackSelector: TrackSelector!,
    bandwidthMeter: BandwidthMeter!,
    rendererCapabilities: Array<RendererCapabilities!>!,
    allocator: Allocator!,
    preloadLooper: Looper!
)

Creates a new factory for PreloadMediaSource.

Parameters
mediaSourceFactory: MediaSource.Factory!

The underlying MediaSource.Factory.

preloadControl: PreloadMediaSource.PreloadControl!

The PreloadControl that will control the progress of preloading the created PreloadMediaSource instances.

trackSelector: TrackSelector!

The TrackSelector. The instance passed should be initialized.

bandwidthMeter: BandwidthMeter!

The BandwidthMeter. It should be the same bandwidth meter of the ExoPlayer that is injected by setBandwidthMeter.

rendererCapabilities: Array<RendererCapabilities!>!

The array of RendererCapabilities. It should be derived from the same RenderersFactory of the ExoPlayer that is injected by setRenderersFactory.

allocator: Allocator!

The Allocator. It should be the same allocator of the that is injected by setLoadControl.

preloadLooper: Looper!

The Looper that will be used for preloading. It should be the same looper with setPlaybackLooper that will play the created PreloadMediaSource instances.

Public functions

createMediaSource

fun createMediaSource(mediaItem: MediaItem!): PreloadMediaSource!

Creates a new MediaSource with the specified MediaItem.

Parameters
mediaItem: MediaItem!

The media item to play.

Returns
PreloadMediaSource!

The new media source.

createMediaSource

fun createMediaSource(mediaSource: MediaSource!): PreloadMediaSource!

getSupportedTypes

fun getSupportedTypes(): IntArray<Int>!

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

setCmcdConfigurationFactory

fun setCmcdConfigurationFactory(
    cmcdConfigurationFactory: CmcdConfiguration.Factory!
): PreloadMediaSource.Factory!

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

Returns
PreloadMediaSource.Factory!

This factory, for convenience.

setDrmSessionManagerProvider

fun setDrmSessionManagerProvider(
    drmSessionManagerProvider: DrmSessionManagerProvider!
): PreloadMediaSource.Factory!

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

Returns
PreloadMediaSource.Factory!

This factory, for convenience.

setLoadErrorHandlingPolicy

fun setLoadErrorHandlingPolicy(
    loadErrorHandlingPolicy: LoadErrorHandlingPolicy!
): PreloadMediaSource.Factory!

Sets an optional LoadErrorHandlingPolicy.

Returns
PreloadMediaSource.Factory!

This factory, for convenience.