Ad lifecycle
Playback states
Every playback ends with the AdDestroyed event — however it ends.
Single ad
Events over time
Example for a 20-second ad that becomes skippable after 5 seconds:
AdStarted0 s · playAd()AdFirstQuartile5 s · 25 %AdSkippableStateChanged5 s · skipoffset 5 sAdMidpoint10 s · 50 %AdThirdQuartile15 s · 75 %AdComplete20 s · 100 %
How the SDK knows the time
In apps, the SDK calculates quartiles and the skip point from timeupdateAd() calls. Without them, no events will follow AdStarted. In the browser, and for VPAID, the SDK tracks the time itself.
Ad pod
If the VAST contains multiple ads, the SDK shows them one after another. Each ad goes through its own cycle from AdLoaded to AdDestroyed.
| Event | How many times |
|---|---|
AdStarted | Once per pod |
AdLoaded, AdCreativeStarted, quartiles, AdComplete, AdDestroyed | For each ad |
AdPodCompleted | Once, after the last ad |
AdsEnded | Once, at the end of all ads (browser only) |
ad_number is the ad's position in the pod, starting at 1. For a single-ad response, ad_number is -1.
Skipping
The skip time comes from the VAST (skipoffset). If an ad doesn't have one, it can't be skipped and the button doesn't appear.
Ad click
The SDK doesn't open the link itself: the app does, on the AdClick event. getAdCloseAct() tells you how to behave after the click-through — close the ad or pause it.
Errors
Error codes are listed under Errors.
When to close the ad
In an app, close the WebView; in the browser, call controller.destroy().