VideoController

class VideoController


An object that provides playback control for video ads.

Summary

Nested types

@IntDef(value = [0, 1, 2, 3, 5])
annotation VideoController.PlaybackState

The playback state of the video ad.

Callback for receiving updates on video ad lifecycle events.

Public constructors

Public functions

Float

Currently this method is not supported for mediation.

Float

Currently this method is not supported for mediation.

Boolean

Currently this method is not supported for mediation.

Boolean

Currently this method is not supported for mediation.

Boolean

Currently this method is not supported for mediation.

Boolean

Currently this method is not supported for mediation.

Unit
mute(mute: Boolean)

Sets the video mute state.

Unit

Pauses the video ad if applicable.

Unit

Play the video ad if applicable.

Unit

Stops video playback.

Constants

PLAYBACK_STATE_ENDED

const val PLAYBACK_STATE_ENDED = 3: Int

PLAYBACK_STATE_PAUSED

const val PLAYBACK_STATE_PAUSED = 2: Int

PLAYBACK_STATE_PLAYING

const val PLAYBACK_STATE_PLAYING = 1: Int

PLAYBACK_STATE_READY

const val PLAYBACK_STATE_READY = 5: Int

PLAYBACK_STATE_UNKNOWN

const val PLAYBACK_STATE_UNKNOWN = 0: Int

Public constructors

VideoController

VideoController()

Public functions

getVideoCurrentTime

fun getVideoCurrentTime(): Float

Currently this method is not supported for mediation. Always returns 0f.

getVideoDuration

fun getVideoDuration(): Float

Currently this method is not supported for mediation. Always returns 0f.

hasVideoContent

fun hasVideoContent(): Boolean

Currently this method is not supported for mediation. Always returns false.

isClickToExpandEnabled

fun isClickToExpandEnabled(): Boolean

Currently this method is not supported for mediation. Always returns false.

isCustomControlsEnabled

fun isCustomControlsEnabled(): Boolean

Currently this method is not supported for mediation. Always returns false.

isMuted

fun isMuted(): Boolean

Currently this method is not supported for mediation. Always returns false.

mute

fun mute(mute: Boolean): Unit

Sets the video mute state.

This video control method only works when [isCustomControlsEnabled] returns true.

Parameters
mute: Boolean

true if video should be muted, false for unmuted

pause

fun pause(): Unit

Pauses the video ad if applicable. This method is a no-op if the video is already paused or the video has ended.

This video control method only works when [isCustomControlsEnabled] returns true.

play

fun play(): Unit

Play the video ad if applicable. This method is a no-op if the video is already playing or the video has ended.

This video control method only works when [isCustomControlsEnabled] returns true.

stop

fun stop(): Unit

Stops video playback. Subsequent calls to play will resume at the beginning of the video. This method is a no-op if the video has already been stopped.

The ad unit must be in the allow list to be able to use this api. If you are interested in using this feature, reach out to your account manager.