ImaServerSideAdInsertionMediaSource.Factory


public final class ImaServerSideAdInsertionMediaSource.Factory implements MediaSource.Factory


Factory for creating ImaServerSideAdInsertionMediaSources.

Apps can use the ImaServerSideAdInsertionMediaSource.Factory to customized the DefaultMediaSourceFactory that is used to build a player:

Summary

Public constructors

Factory(
    ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader,
    MediaSource.Factory contentMediaSourceFactory
)

Creates a new factory for ImaServerSideAdInsertionMediaSources.

Public methods

MediaSource

Creates a new MediaSource with the specified MediaItem.

int[]

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

MediaSource.Factory

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

MediaSource.Factory

Sets an optional LoadErrorHandlingPolicy.

Inherited methods

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

MediaSource.Factory

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

MediaSource.Factory

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

Public constructors

Factory

public Factory(
    ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader,
    MediaSource.Factory contentMediaSourceFactory
)

Creates a new factory for ImaServerSideAdInsertionMediaSources.

Parameters
ImaServerSideAdInsertionMediaSource.AdsLoader adsLoader

The AdsLoader.

MediaSource.Factory contentMediaSourceFactory

The content media source factory to create content sources.

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.

getSupportedTypes

@C.ContentType
public int[] getSupportedTypes()

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

setDrmSessionManagerProvider

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

@CanIgnoreReturnValue
public MediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
MediaSource.Factory

This factory, for convenience.