Ads JavaScript APIs (Player V2 Deprecated)

Ads JavaScript APIs can be used to respond to events such as starting, clicking, completing and skipping ads.

Ads Functions

Important: Ooyala Player V2 is deprecated and is scheduled to be disabled on 2018-01-31. After that date, Player V2 will no longer play your video or audio content. Customers still using Player V2 need to migrate to Player V4 (see Player V4.

The following table describes all the JavaScript functions that are associated with ads.

Function Description
skipAd( )

Skip the current ad. Use this JavaScript function to enable your viewers to skip ads. This function only works for Ooyala ads or normal display ads. If you use a third party ad manager and try to use the skipAd( ) function it will not work unless the third party ad manager has implemented a skip Ad functionality on its own. You can use the event adStarted (ad loading and starting to play) to trigger the skipAd() function. Exceptions: This method throws an exception if no ads are associated with the current embed code. Errors: If you have not had the feature enabled, you may get a TypeError: document.getElementById(playerId).skipAd is not a function error. Note: This function is available on a per request basis. To enable this feature, contact Sales, your Customer Success Manager, or Technical Support.

Ads Event Handling

The following table describes all the JavaScript events that are associated with ads.

Event Parameters of the third argument to callback Description

adClicked Cancelable. Parameters: (format, source, type) Example: (video, doubleClick, adClicked)

An ad has been clicked on. The event is only fired for VAST ads, Google AFV, DoubleClick, and YuMe.

adCompleted Cancelable Parameters: (format, source, type) Example: (video, doubleClick, adClicked)

An ad has finished playing.

Cancelable Parameters: (Type) Return Values: ad object array Example: ("companionAds"). companionAds would be an ad object array. The ad objects have the following properties: (clickThroughURL, creativeType, resourceType, url)

One or more companion ads are ready to be displayed. Only applicable to VAST compliant ads. cancelable, type (e.g., "companionAds"),

Related Information

The following list provides links to background information on Ooyala Backlot that is related to the Player ad APIs and to monetization.