VideoAdPlayer

interface VideoAdPlayer : AdProgressProvider, VolumeProvider


Defines the set of methods that a video player must implement to be used by the IMA SDK, as well as a set of callbacks that it must fire. This player should use the callbacks provided while interacting with ads only. VideoAdPlayer interface should be controlled only by IMA SDK and should not be accessed by the application directly. Use AdsManager API to control ad playback.

Summary

Nested types

Callbacks that the player must fire.

Public functions

Unit

Adds a callback.

Unit
loadAd(adMediaInfo: AdMediaInfo!, adPodInfo: AdPodInfo!)

Loads a video ad hosted at AdMediaInfo.

Unit
pauseAd(adMediaInfo: AdMediaInfo!)

Pauses playing the current ad.

Unit
playAd(adMediaInfo: AdMediaInfo!)

Starts or resumes playing the video ad referenced by the AdMediaInfo, provided loadAd has already been called for it.

Unit

Cleans up and releases all resources used by the VideoAdPlayer.

Unit

Removes a callback.

Unit
stopAd(adMediaInfo: AdMediaInfo!)

Stops playing the current ad.

Inherited functions

From com.google.ads.interactivemedia.v3.api.player.AdProgressProvider
VideoProgressUpdate!

Returns VideoProgressUpdate describing playback progress of the current ad or VideoProgressUpdate#VIDEO_TIME_NOT_READY if video details are not yet available.

From com.google.ads.interactivemedia.v3.api.player.VolumeProvider
Int

Returns the volume of the player as a percentage from 0 to 100.

Public functions

addCallback

fun addCallback(callback: VideoAdPlayer.VideoAdPlayerCallback!): Unit

Adds a callback.

loadAd

fun loadAd(adMediaInfo: AdMediaInfo!, adPodInfo: AdPodInfo!): Unit

Loads a video ad hosted at AdMediaInfo. This is the first call the VideoAdPlayer will receive for a given Ad Media. The player should store the instance of AdMediaInfo and include it when calling all methods from the VideoAdPlayerCallback. Should only be called by the SDK.

pauseAd

fun pauseAd(adMediaInfo: AdMediaInfo!): Unit

Pauses playing the current ad. Should only be called by the SDK.

playAd

fun playAd(adMediaInfo: AdMediaInfo!): Unit

Starts or resumes playing the video ad referenced by the AdMediaInfo, provided loadAd has already been called for it. Should only be called by the SDK.

release

fun release(): Unit

Cleans up and releases all resources used by the VideoAdPlayer. Should only be called by the SDK.

removeCallback

fun removeCallback(callback: VideoAdPlayer.VideoAdPlayerCallback!): Unit

Removes a callback.

stopAd

fun stopAd(adMediaInfo: AdMediaInfo!): Unit

Stops playing the current ad. Also used to clean up an ad after completion. Should only be called by the SDK.