Class: AdDisplayContainer

Constructor

AdDisplayContainer

new AdDisplayContainer(containerElement, videoElement, clickTrackingElement)

Parameter

containerElement

The element to display the ads in. The element must be inserted into the DOM before creating AdDisplayContainer.

Value must not be null.

videoElement

Optional

Specifies the alternative video ad playback element. We recommend always passing in your content video player.

clickTrackingElement

Optional

Specifies the alternative video ad click element. Leave this null to let the SDK handle clicks. Even if supplied, the SDK will only use the custom click tracking element when non-AdSense/AdX creatives are displayed in environments that do not support UI elements overlaying a video player (for example, iPhone or pre-4.0 Android). The custom click tracking element should never be rendered over the video player because it can intercept clicks to UI elements that the SDK renders. Also note that the SDK will not modify the visibility of the custom click tracking element. This means that if a custom click tracking element is supplied, it must be properly displayed when the linear ad is played. You can check ima.AdsManager.isCustomClickTrackingUsed when the ima.AdEvent.Type.STARTED event is fired to determine whether or not to display your custom click tracking element. If appropriate for your UI, you should hide the click tracking element when the ima.AdEvent.Type.CONTENT_RESUME_REQUESTED event fires.

Implements
AdDisplayContainerInterface

Methods

destroy

destroy() returns void

Destroys internal state and previously created DOM elements. The IMA SDK will be unloaded and no further calls to any APIs should be made.

Returns

void 

initialize

initialize() returns void

Initializes the internal video elements for playback. You must call this method as a direct result of a user action, so that the browser can mark the video element as user initiated.

Some browsers will allow video playback without user interactions if the video is muted. For this behavior, use AdsRequest.setAdWillPlayMuted(true) and call this method before AdsManager.start().

Returns

void