HlsInterstitialsAdsLoader.AdsMediaSourceFactory


public final class HlsInterstitialsAdsLoader.AdsMediaSourceFactory implements MediaSource.Factory


A MediaSource.Factory to create a media source to play HLS streams with interstitials.

Summary

Public constructors

AdsMediaSourceFactory(
    HlsInterstitialsAdsLoader adsLoader,
    AdViewProvider adViewProvider,
    Context context
)

Creates an instance with a .

AdsMediaSourceFactory(
    HlsInterstitialsAdsLoader adsLoader,
    AdViewProvider adViewProvider,
    MediaSource.Factory mediaSourceFactory
)

Creates an instance with a custom MediaSource.Factory.

Public methods

MediaSource

Creates a new MediaSource with the specified MediaItem.

int[]

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

HlsInterstitialsAdsLoader.AdsMediaSourceFactory

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

HlsInterstitialsAdsLoader.AdsMediaSourceFactory

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

AdsMediaSourceFactory

public AdsMediaSourceFactory(
    HlsInterstitialsAdsLoader adsLoader,
    AdViewProvider adViewProvider,
    Context context
)

Creates an instance with a .

Parameters
HlsInterstitialsAdsLoader adsLoader

The HlsInterstitialsAdsLoader.

AdViewProvider adViewProvider

Provider of views for the ad UI.

Context context

The Context.

AdsMediaSourceFactory

public AdsMediaSourceFactory(
    HlsInterstitialsAdsLoader adsLoader,
    AdViewProvider adViewProvider,
    MediaSource.Factory mediaSourceFactory
)

Creates an instance with a custom MediaSource.Factory.

Parameters
HlsInterstitialsAdsLoader adsLoader

The HlsInterstitialsAdsLoader.

AdViewProvider adViewProvider

Provider of views for the ad UI.

MediaSource.Factory mediaSourceFactory

The MediaSource.Factory used to create content and ad media sources.

Throws
java.lang.IllegalStateException

If the provided media source factory doesn't support content type CONTENT_TYPE_HLS.

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 HlsInterstitialsAdsLoader.AdsMediaSourceFactory setDrmSessionManagerProvider(
    DrmSessionManagerProvider drmSessionManagerProvider
)

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

Returns
HlsInterstitialsAdsLoader.AdsMediaSourceFactory

This factory, for convenience.

setLoadErrorHandlingPolicy

@CanIgnoreReturnValue
public HlsInterstitialsAdsLoader.AdsMediaSourceFactory setLoadErrorHandlingPolicy(
    LoadErrorHandlingPolicy loadErrorHandlingPolicy
)

Sets an optional LoadErrorHandlingPolicy.

Returns
HlsInterstitialsAdsLoader.AdsMediaSourceFactory

This factory, for convenience.