AdViewProvider


public interface AdViewProvider

Known direct subclasses
PlayerView

A high level view for Player media playbacks.


Provides information about views for the ad playback UI.

Summary

Public methods

default List<AdOverlayInfo>

Returns a list of AdOverlayInfo instances describing views that are on top of the ad view group, but that are essential for controlling playback and should be excluded from ad viewability measurements.

default @Nullable View

Returns the container View for the video surface that can be resized during ad playback (for example, to accommodate nonlinear or interactive ad overlays), or null if video resizing is not supported.

abstract @Nullable ViewGroup

Returns the ViewGroup on top of the player that will show any ad UI, or null if playing audio-only ads.

Public methods

getAdOverlayInfos

default List<AdOverlayInfo> getAdOverlayInfos()

Returns a list of AdOverlayInfo instances describing views that are on top of the ad view group, but that are essential for controlling playback and should be excluded from ad viewability measurements.

Each view must be either a fully transparent overlay (for capturing touch events), or a small piece of transient UI that is essential to the user experience of playback (such as a button to pause/resume playback or a transient full-screen or cast button). For more information see the documentation for your ads loader.

getAdVideoView

@UnstableApi
default @Nullable View getAdVideoView()

Returns the container View for the video surface that can be resized during ad playback (for example, to accommodate nonlinear or interactive ad overlays), or null if video resizing is not supported.

When non-null, the returned view's layout parameters must be an instance of ViewGroup.MarginLayoutParams with zero default margins, its unresized bounds must match getAdViewGroup, and it must center the video surface within its resized bounds when margins are applied.

getAdViewGroup

abstract @Nullable ViewGroup getAdViewGroup()

Returns the ViewGroup on top of the player that will show any ad UI, or null if playing audio-only ads. Any views on top of the returned view group must be described by AdOverlayInfos returned by getAdOverlayInfos, for accurate viewability measurement.