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
)

This method is deprecated.

This method (and all support for 'legacy' subtitle decoding during rendering) will be removed in a future release.

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.

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

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

@UnstableApi
@C.ContentType
public int[] getSupportedTypes()

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

setDrmSessionManagerProvider

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

@UnstableApi
@CanIgnoreReturnValue
public MediaSource.Factory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
MediaSource.Factory

This factory, for convenience.