HlsInterstitialsAdsLoader.Listener


public interface HlsInterstitialsAdsLoader.Listener


A listener to be notified of events emitted by the ads loader.

Summary

Public methods

default void
onAdCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when an ad period has completed playback and transitioned to the following ad or content period, or the playlist ended.

default void
onAssetListLoadCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    HlsInterstitialsAdsLoader.AssetList assetList
)

Called when an asset list has completed to load for the given ad.

default void
onAssetListLoadFailed(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    @Nullable IOException ioException,
    boolean cancelled
)

Called when an asset list has failed to load for the given ad.

default void
onAssetListLoadStarted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when the asset list has been started to load for the given ad.

default void
onContentTimelineChanged(
    MediaItem mediaItem,
    Object adsId,
    Timeline hlsContentTimeline
)

Called when the timeline of the content media source has changed.

default void
onMetadata(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    Metadata metadata
)

Called when Metadata is emitted by the player during an ad period of an active HLS media item.

default void
onPrepareCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when preparation of an ad period has completed successfully.

default void
onPrepareError(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    IOException exception
)

Called when preparation of an ad period failed.

default void
onStart(
    MediaItem mediaItem,
    Object adsId,
    AdViewProvider adViewProvider
)

Called when the ads loader was started for the given HLS media item and ads ID.

default void
onStop(
    MediaItem mediaItem,
    Object adsId,
    AdPlaybackState adPlaybackState
)

Called when the ads loader was stopped for the given HLS media item.

Public methods

onAdCompleted

default void onAdCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when an ad period has completed playback and transitioned to the following ad or content period, or the playlist ended.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group in the ad media source.

int adIndexInAdGroup

The index of the ad in the ad group.

onAssetListLoadCompleted

default void onAssetListLoadCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    HlsInterstitialsAdsLoader.AssetList assetList
)

Called when an asset list has completed to load for the given ad.

Parameters
MediaItem mediaItem

The MediaItem with which the content media source was created.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group of the ad period.

int adIndexInAdGroup

The index of the ad in the ad group of the ad period.

HlsInterstitialsAdsLoader.AssetList assetList

The AssetList for which loading has completed.

onAssetListLoadFailed

default void onAssetListLoadFailed(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    @Nullable IOException ioException,
    boolean cancelled
)

Called when an asset list has failed to load for the given ad.

Parameters
MediaItem mediaItem

The MediaItem with which the content media source was created.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group of the ad period.

int adIndexInAdGroup

The index of the ad in the ad group of the ad period.

@Nullable IOException ioException

The exception, may be null if cancelled.

boolean cancelled

Whether the load was cancelled.

onAssetListLoadStarted

default void onAssetListLoadStarted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when the asset list has been started to load for the given ad.

Parameters
MediaItem mediaItem

The MediaItem with which the content media source was created.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group of the ad period.

int adIndexInAdGroup

The index of the ad in the ad group of the ad period.

onContentTimelineChanged

default void onContentTimelineChanged(
    MediaItem mediaItem,
    Object adsId,
    Timeline hlsContentTimeline
)

Called when the timeline of the content media source has changed. The HlsManifest of the content source can be accessed through manifest.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

Timeline hlsContentTimeline

The latest Timeline.

onMetadata

default void onMetadata(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    Metadata metadata
)

Called when Metadata is emitted by the player during an ad period of an active HLS media item.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group in the ad media source.

int adIndexInAdGroup

The index of the ad in the ad group.

Metadata metadata

The emitted Metadata.

onPrepareCompleted

default void onPrepareCompleted(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup
)

Called when preparation of an ad period has completed successfully.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group in the ad media source.

int adIndexInAdGroup

The index of the ad in the ad group.

onPrepareError

default void onPrepareError(
    MediaItem mediaItem,
    Object adsId,
    int adGroupIndex,
    int adIndexInAdGroup,
    IOException exception
)

Called when preparation of an ad period failed.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

int adGroupIndex

The index of the ad group in the ad media source.

int adIndexInAdGroup

The index of the ad in the ad group.

IOException exception

The IOException thrown when preparing.

onStart

default void onStart(
    MediaItem mediaItem,
    Object adsId,
    AdViewProvider adViewProvider
)

Called when the ads loader was started for the given HLS media item and ads ID.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

AdViewProvider adViewProvider

Provider of views for the ad UI.

onStop

default void onStop(
    MediaItem mediaItem,
    Object adsId,
    AdPlaybackState adPlaybackState
)

Called when the ads loader was stopped for the given HLS media item.

Parameters
MediaItem mediaItem

The MediaItem of the content media source.

Object adsId

The ads identifier (see adsId).

AdPlaybackState adPlaybackState

The AdPlaybackState after the ad media source was released.