VideoController

public final class VideoController


An object that provides playback control for video ads.

Summary

Nested types

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

The playback state of the video ad.

Callback for receiving updates on video ad lifecycle events.

Constants

static final int
static final int
static final int
static final int
static final int

Public constructors

Public methods

final float

Currently this method is not supported for mediation.

final float

Currently this method is not supported for mediation.

final boolean

Currently this method is not supported for mediation.

final boolean

Currently this method is not supported for mediation.

final boolean

Currently this method is not supported for mediation.

final boolean

Currently this method is not supported for mediation.

final void
mute(boolean mute)

Sets the video mute state.

final void

Pauses the video ad if applicable.

final void

Play the video ad if applicable.

final void

Stops video playback.

Constants

PLAYBACK_STATE_ENDED

public static final int PLAYBACK_STATE_ENDED = 3

PLAYBACK_STATE_PAUSED

public static final int PLAYBACK_STATE_PAUSED = 2

PLAYBACK_STATE_PLAYING

public static final int PLAYBACK_STATE_PLAYING = 1

PLAYBACK_STATE_READY

public static final int PLAYBACK_STATE_READY = 5

PLAYBACK_STATE_UNKNOWN

public static final int PLAYBACK_STATE_UNKNOWN = 0

Public constructors

VideoController

public VideoController()

Public methods

getVideoCurrentTime

public final float getVideoCurrentTime()

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

getVideoDuration

public final float getVideoDuration()

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

hasVideoContent

public final boolean hasVideoContent()

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

isClickToExpandEnabled

public final boolean isClickToExpandEnabled()

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

isCustomControlsEnabled

public final boolean isCustomControlsEnabled()

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

isMuted

public final boolean isMuted()

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

mute

public final void mute(boolean mute)

Sets the video mute state.

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

Parameters
boolean mute

true if video should be muted, false for unmuted

pause

public final void pause()

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

public final void play()

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

public final void stop()

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.