google.ima. AdEvent
This event type is raised by the ad as a notification when the ad state changes and when users interact with the ad. For example, when the ad starts playing, is clicked on, and more. You can register for the various state changed events on AdsManager.
Enumeration
Type
string
Types of AdEvents
Value |
|
---|---|
AD_CAN_PLAY |
Fires when the ad is ready to play without buffering, either at the beginning of the ad or after buffering completes. |
CONTENT_PAUSE_REQUESTED |
Fires when content should be paused. This usually happens right before an ad is about to cover the content. |
CONTENT_RESUME_REQUESTED |
Fires when content should be resumed. This usually happens when an ad finishes or collapses. |
CLICK |
Fires when the ad is clicked. |
VIDEO_CLICKED |
Fires when the non-clickthrough portion of a video ad is clicked. |
VIDEO_ICON_CLICKED |
Fires when a user clicks a video icon. |
STARTED |
Fires when the ad starts playing. |
AD_PROGRESS |
Fires when the ad's current time value changes. Calling getAdData() on this event will return an AdProgressData object. |
AD_BUFFERING |
Fires when the ad has stalled playback to buffer. |
IMPRESSION |
Fires when the impression URL has been pinged. |
PAUSED |
Fires when the ad is paused. |
RESUMED |
Fires when the ad is resumed. |
FIRST_QUARTILE |
Fires when the ad playhead crosses first quartile. |
MIDPOINT |
Fires when the ad playhead crosses midpoint. |
THIRD_QUARTILE |
Fires when the ad playhead crosses third quartile. |
COMPLETE |
Fires when the ad completes playing. |
DURATION_CHANGE |
Fires when the ad's duration changes. |
USER_CLOSE |
Fires when the ad is closed by the user. |
LOADED |
Fires when ad data is available. |
ALL_ADS_COMPLETED |
Fires when the ads manager is done playing all the valid ads in the ads response, or when the response doesn't return any valid ads. |
SKIPPED |
Fires when the ad is skipped by the user. |
LINEAR_CHANGED |
Fires when the displayed ad changes from linear to nonlinear, or the reverse. |
SKIPPABLE_STATE_CHANGED |
Fires when the displayed ads skippable state is changed. |
AD_METADATA |
Fires when an ads list is loaded. |
AD_BREAK_FETCH_ERROR |
Fires when an ad break will not play back any ads. |
AD_BREAK_READY |
Fires when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false. |
LOG |
Fires 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 |
Fires when the ad volume has changed. |
VOLUME_MUTED |
Fires when the ad volume has been muted. |
INTERACTION |
Fires when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data. |
Property
Type
string
Types of AdEvents
Value |
|
---|---|
AD_CAN_PLAY |
Fires when the ad is ready to play without buffering, either at the beginning of the ad or after buffering completes. |
CONTENT_PAUSE_REQUESTED |
Fires when content should be paused. This usually happens right before an ad is about to cover the content. |
CONTENT_RESUME_REQUESTED |
Fires when content should be resumed. This usually happens when an ad finishes or collapses. |
CLICK |
Fires when the ad is clicked. |
VIDEO_CLICKED |
Fires when the non-clickthrough portion of a video ad is clicked. |
VIDEO_ICON_CLICKED |
Fires when a user clicks a video icon. |
STARTED |
Fires when the ad starts playing. |
AD_PROGRESS |
Fires when the ad's current time value changes. Calling getAdData() on this event will return an AdProgressData object. |
AD_BUFFERING |
Fires when the ad has stalled playback to buffer. |
IMPRESSION |
Fires when the impression URL has been pinged. |
PAUSED |
Fires when the ad is paused. |
RESUMED |
Fires when the ad is resumed. |
FIRST_QUARTILE |
Fires when the ad playhead crosses first quartile. |
MIDPOINT |
Fires when the ad playhead crosses midpoint. |
THIRD_QUARTILE |
Fires when the ad playhead crosses third quartile. |
COMPLETE |
Fires when the ad completes playing. |
DURATION_CHANGE |
Fires when the ad's duration changes. |
USER_CLOSE |
Fires when the ad is closed by the user. |
LOADED |
Fires when ad data is available. |
ALL_ADS_COMPLETED |
Fires when the ads manager is done playing all the valid ads in the ads response, or when the response doesn't return any valid ads. |
SKIPPED |
Fires when the ad is skipped by the user. |
LINEAR_CHANGED |
Fires when the displayed ad changes from linear to nonlinear, or the reverse. |
SKIPPABLE_STATE_CHANGED |
Fires when the displayed ads skippable state is changed. |
AD_METADATA |
Fires when an ads list is loaded. |
AD_BREAK_FETCH_ERROR |
Fires when an ad break will not play back any ads. |
AD_BREAK_READY |
Fires when an ad rule or a VMAP ad break would have played if autoPlayAdBreaks is false. |
LOG |
Fires 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 |
Fires when the ad volume has changed. |
VOLUME_MUTED |
Fires when the ad volume has been muted. |
INTERACTION |
Fires when an ad triggers the interaction callback. Ad interactions contain an interaction ID string in the ad data. |
Methods
getAd
getAd() returns (null or Ad)
Get the current ad that is playing or just played.
- Returns
-
(null or non-null Ad)
The ad associated with the event, or null if there is no relevant ad.
getAdData
getAdData() returns (null or non-null Object with any type properties)
Allows extra data to be passed from the ad.
Example:
if (event.type == google.ima.AdEvent.Type.LOG) {
let adData = event.getAdData();
if (adData['adError']) {
console.log('Non-fatal error occurred: ' +
adData['adError'].getMessage());
}
}
- Returns
-
(null or non-null Object with any type properties)
Extra data for the event. Log events raised for error carry object of type 'google.ima.AdError' which can be accessed using 'adError' key.