VideoController

public final classVideoControllerextendsObject

An object that provides playback control for video ads.

Nested Class Summary

class VideoController.VideoLifecycleCallbacks Callback for receiving updates on video ad lifecycle events.

Public Method Summary

VideoController.VideoLifecycleCallbacks
getVideoLifecycleCallbacks()
Returns the previously provided VideoController.VideoLifecycleCallbacksor null if no instance was provided.
boolean
hasVideoContent()
Returns true if the current ad has video content.
boolean
isClickToExpandEnabled()
Returns true if the video ad is using click to expand behavior.
boolean
isCustomControlsEnabled()
Returns true if the video ad is using custom player controls.
boolean
isMuted()
Returns true if the video is currently muted, false otherwise.
void
mute(boolean mute)
Sets the video mute state.
void
pause()
Pauses the video ad if applicable.
void
play()
Play the video ad if applicable.
void
setVideoLifecycleCallbacks(VideoController.VideoLifecycleCallbacks callbacks)
Sets a listener that will receive callbacks for video events.
void
stop()
Stops video playback.

Inherited Method Summary

Public Methods

public VideoController.VideoLifecycleCallbacksgetVideoLifecycleCallbacks()

Returns the previously provided VideoController.VideoLifecycleCallbacksor null if no instance was provided.

public booleanhasVideoContent()

Returns true if the current ad has video content.

public booleanisClickToExpandEnabled()

Returns true if the video ad is using click to expand behavior.

public booleanisCustomControlsEnabled()

Returns true if the video ad is using custom player controls. If custom player controls are used, then it is the app's responsibility to render provide play/pause and mute/unmute controls and callplay(), pause(), andmute(boolean) at the appropriate times.

Use VideoOptions.Builder.setCustomControlsRequested(boolean)to enable custom controls.

Custom controls are currently only available for Ad Manager reservations.

public booleanisMuted()

Returns true if the video is currently muted, false otherwise.

public voidmute(boolean mute)

Sets the video mute state.

This video control method only works when isCustomControlsEnabled()returns true.

Parameters
mute true if video should be muted, false for unmuted

public voidpause()

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.

public voidplay()

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.

public voidsetVideoLifecycleCallbacks(VideoController.VideoLifecycleCallbacks callbacks)

Sets a listener that will receive callbacks for video events.

Parameters
callbacks the object that is to receive lifecycle callbacks

public voidstop()

Stops video playback. Subsequent calls toplay() 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.