HlsInterstitialsAdsLoader.Listener


interface HlsInterstitialsAdsLoader.Listener


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

Summary

Public functions

Unit
onAdCompleted(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int
)

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

Unit
onContentTimelineChanged(
    mediaItem: MediaItem!,
    adsId: Any!,
    hlsContentTimeline: Timeline!
)

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

Unit
onMetadata(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int,
    metadata: Metadata!
)

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

Unit
onPrepareCompleted(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int
)

Called when preparation of an ad period has completed successfully.

Unit
onPrepareError(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int,
    exception: IOException!
)

Called when preparation of an ad period failed.

Unit
onStart(mediaItem: MediaItem!, adsId: Any!, adViewProvider: AdViewProvider!)

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

Unit
onStop(mediaItem: MediaItem!, adsId: Any!, adPlaybackState: AdPlaybackState!)

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

Public functions

onAdCompleted

fun onAdCompleted(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int
): Unit

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.

adsId: Any!

The ads ID of the ads media source.

adGroupIndex: Int

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

adIndexInAdGroup: Int

The index of the ad in the ad group.

onContentTimelineChanged

fun onContentTimelineChanged(
    mediaItem: MediaItem!,
    adsId: Any!,
    hlsContentTimeline: Timeline!
): Unit

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.

adsId: Any!

The ads ID of the ads media source.

hlsContentTimeline: Timeline!

The latest Timeline.

onMetadata

fun onMetadata(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int,
    metadata: Metadata!
): Unit

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.

adsId: Any!

The ads ID of the ads media source.

adGroupIndex: Int

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

adIndexInAdGroup: Int

The index of the ad in the ad group.

metadata: Metadata!

The emitted Metadata.

onPrepareCompleted

fun onPrepareCompleted(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int
): Unit

Called when preparation of an ad period has completed successfully.

Parameters
mediaItem: MediaItem!

The MediaItem of the content media source.

adsId: Any!

The ads ID of the ads media source.

adGroupIndex: Int

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

adIndexInAdGroup: Int

The index of the ad in the ad group.

onPrepareError

fun onPrepareError(
    mediaItem: MediaItem!,
    adsId: Any!,
    adGroupIndex: Int,
    adIndexInAdGroup: Int,
    exception: IOException!
): Unit

Called when preparation of an ad period failed.

Parameters
mediaItem: MediaItem!

The MediaItem of the content media source.

adsId: Any!

The ads ID of the ads media source.

adGroupIndex: Int

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

adIndexInAdGroup: Int

The index of the ad in the ad group.

exception: IOException!

The IOException thrown when preparing.

onStart

fun onStart(mediaItem: MediaItem!, adsId: Any!, adViewProvider: AdViewProvider!): Unit

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.

adsId: Any!

The ads ID of the ads media source.

adViewProvider: AdViewProvider!

Provider of views for the ad UI.

onStop

fun onStop(mediaItem: MediaItem!, adsId: Any!, adPlaybackState: AdPlaybackState!): Unit

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

Parameters
mediaItem: MediaItem!

The MediaItem of the content media source.

adsId: Any!

The ads ID of the ads media source.

adPlaybackState: AdPlaybackState!

The AdPlaybackState after the ad media source was released.