VideoController

public interface VideoController


An object that provides playback control for video ads.

Summary

Nested types

Callback for receiving updates on video ad lifecycle events.

Public methods

abstract VideoController.VideoLifecycleCallbacks

Callback for receiving video events.

abstract boolean

Returns true if the video ad is using custom video playback controls.

abstract boolean

true if the video is currently muted, false otherwise.

abstract void
mute(boolean mute)

Sets the video mute state.

abstract void

Pauses the video ad if applicable.

abstract void

Play the video ad if applicable.

abstract void

Callback for receiving video events.

abstract void

Stops video playback.

Public methods

getVideoLifecycleCallbacks

abstract VideoController.VideoLifecycleCallbacks getVideoLifecycleCallbacks()

Callback for receiving video events.

isCustomControlsEnabled

abstract boolean isCustomControlsEnabled()

Returns true if the video ad is using custom video playback controls. When custom controls are enabled, it is the app's responsibility to render and provide play/pause and mute/unmute controls and call play, pause, and mute at the appropriate times.

Use VideoOptions.Builder.customControlsRequested to enable custom controls.

This feature is currently only available for Ad Manager reservation ads.

isMuted

abstract boolean isMuted()

true if the video is currently muted, false otherwise.

mute

abstract 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

abstract 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

abstract void play()

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

This video control method only works when isCustomControlsEnabled returns true.

setVideoLifecycleCallbacks

abstract void setVideoLifecycleCallbacks(
    VideoController.VideoLifecycleCallbacks videoLifecycleCallbacks
)

Callback for receiving video events.

stop

abstract 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 allowlist to be able to use this API. If you are interested in using this feature, reach out to your account manager.