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!>!,
    loadControl: LoadControl!,
    preloadLooper: Looper!
)

Creates a new factory for PreloadMediaSource.

Inherited functions

From androidx.media3.exoplayer.source.MediaSource.Factory
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.

MediaSource.Factory!

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

MediaSource.Factory!

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

Public constructors

Factory

Factory(
    mediaSourceFactory: MediaSource.Factory!,
    preloadControl: PreloadMediaSource.PreloadControl!,
    trackSelector: TrackSelector!,
    bandwidthMeter: BandwidthMeter!,
    rendererCapabilities: Array<RendererCapabilities!>!,
    loadControl: LoadControl!,
    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.

loadControl: LoadControl!

The LoadControl. It should be the same instance of the ExoPlayer 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.

setClock

@CanIgnoreReturnValue
fun setClock(clock: Clock!): PreloadMediaSource.Factory!

Sets the Clock that will be used by the PreloadMediaSource. Should only be set for testing purposes.

Returns
PreloadMediaSource.Factory!

This factory, for convenience.

setCmcdConfigurationFactory

@CanIgnoreReturnValue
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

@CanIgnoreReturnValue
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

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

Sets an optional LoadErrorHandlingPolicy.

Returns
PreloadMediaSource.Factory!

This factory, for convenience.