AdItem

data class AdItem(val sources: Array<AdSource>, val position: String = "pre", val replaceContentDuration: Double = 0.0, val preloadOffset: Double = 0.0) : Parcelable

Represents an ad break which can be scheduled for playback.

One single AdItem can have multiple AdSources where all but the first act as fallback ad sources if the first one fails to load. The start and end of an ad break are signaled via PlayerEvent.AdBreakStarted and PlayerEvent.AdBreakFinished.

If the ad view group is removed or set the first time (e.g. by passing null to Player.setAdViewGroup or by moving the hosting app to the background) after an IMA AdSource has been loaded, the according AdItem is discarded. The same holds true if the ad view group is removed or set during ad playback. This doesn't affect progressive AdSources.

Constructors

Link copied to clipboard
constructor(vararg sources: AdSource)
constructor(position: String, vararg sources: AdSource)
constructor(position: String, replaceContentDuration: Double, vararg sources: AdSource)
constructor(sources: Array<AdSource>, position: String = "pre", replaceContentDuration: Double = 0.0, preloadOffset: Double = 0.0)

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int

Properties

Link copied to clipboard

The playback position at which the ad break is scheduled to start. Default value is "pre".

Link copied to clipboard

The amount of seconds the ad manifest is loaded in advance compared to when the ad break is scheduled for playback.

Link copied to clipboard

The amount of seconds of the main video content that should be replaced by this ad break.

Link copied to clipboard

The AdSources that make up this AdItem. The first ad source in this array is used as the main ad. Subsequent ad sources act as a fallback, meaning that if the main ad source does not provide a valid response, the subsequent ad sources will be utilized one after another.