Class: AdEvent

Constructor

AdEvent

new AdEvent(type, ad, opt_adData)

Parameter

type

string

The Type of the event.

ad

Optional

ima.Ad

The current ad that is playing or has just played.

Value may be null.

opt_adData

Optional

Object

Extra data for the event if needed.

Value may be null.

Extends
goog.events.Event

Property

Type

static

string

Types of AdEvents

Value

CONTENT_PAUSE_REQUESTED

Fired when content should be paused. This usually happens right before an ad is about to cover the content.

CONTENT_RESUME_REQUESTED

Fired when content should be resumed. This usually happens when an ad finishes or collapses.

CLICK

Fired when the ad is clicked.

STARTED

Fired when the ad starts playing.

AD_PROGRESS

Fired when the ad's current time value changes. Calling getAdData() on this event will return an AdProgressData object.

AD_BUFFERING

Fired when the ad has stalled playback to buffer.

IMPRESSION

Fired when the impression URL has been pinged.

PAUSED

Fired when the ad is paused.

RESUMED

Fired when the ad is resumed.

FIRST_QUARTILE

Fired when the ad playhead crosses first quartile.

MIDPOINT

Fired when the ad playhead crosses midpoint.

THIRD_QUARTILE

Fired when the ad playhead crosses third quartile.

COMPLETE

Fired when the ad completes playing.

DURATION_CHANGE

Fired when the ad's duration changes.

USER_CLOSE

Fired when the ad is closed by the user.

LOADED

Fired when ad data is available.

ALL_ADS_COMPLETED

Fired when the ads manager is done playing all the ads.

SKIPPED

Fired when the ad is skipped by the user.

LINEAR_CHANGED

Fired when the displayed ad changes from linear to nonlinear, or vice versa.

SKIPPABLE_STATE_CHANGED

Fired when the displayed ads skippable state is changed.

AD_METADATA

Fired when an ads list is loaded.

AD_BREAK_READY

Fired when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false.

LOG

Fired when a non-fatal error is encountered. The user need not take any action since the SDK will continue with the same or next ad playback depending on the error situation.

VOLUME_CHANGED

Fired when the ad volume has changed.

VOLUME_MUTED

Fired when the ad volume has been muted.

INTERACTION

Fired when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data.

Methods

getAd

getAd() returns ima.Ad

Get the current ad that is playing or just played.

Returns

nullable ima.Ad The ad associated with the event, or null if there is no relevant ad.

getAdData

getAdData() returns Object

Allows extra data to be passed from the ad.

Example:


if (event.type == google.ima.AdEvent.Type.LOG) {
  var adData = event.getAdData();
  if (adData['adError']) {
    console.log('Non-fatal error occurred: ' +
        adData['adError'].getMessage();
  }
}

Returns

nullable Object Extra data for the event. Log events raised for error carry object of type 'google.ima.AdError' which can be accessed using 'adError' key.