Custom Video Controls

When displaying reserved native ads that include video assets, you can display
your own video controls for play, pause, mute, and unmute. This guide outlines
how to implement this feature in an Android app.

Request custom video controls

The first step is to request custom video controls. This is done using the
VideoOptions
class.

First, create an instance of the VideoOptions.Builder(), and call
setCustomControlsRequested() with a value of true. Next, build an instance
of NativeAdOptions
using this set of video options, and then build an
AdLoader
with the
NativeAdOptions
instance.

Kotlin

Implement custom controls

If the ad does have video content and custom controls are enabled, you should
then display your custom controls along with the ad, as the ad will not show any
controls itself. The controls can then call the relevant methods on the
VideoController.

These methods are:

mute(boolean mute) - Mute / unmute the video

play() - Play the video

pause() - Pause the video

isMuted() - Check the mute state of the video controller

For an implementation example, check out the Google Ad Manager Custom Controls
example in the API Demo in our sample apps.