Classes

PublisherAPI

Typedefs

AdBreak : Object

Definition of the upcoming ad slot.

EnvironmentVars : Object

Used for passing implementation-specific runtime variables.

Wrapper : Array

List of URLs that have been requested during a chain of ad server requests.

UniversalAdID : Object

A unique creative ID for the ad across multiple systems.

AdInfo : Object

Collection of data that describes the current video ad.

CompanionAd : Object

Secondary ads included in the VAST tag that accompany the video ad.

Extension : Object

Custom XML element that extends the video ad.

PublisherAPI

Kind: global class

new PublisherAPI(playerProxy, config)

Param Type Description
playerProxy Object extended from FacadeBase
config Object Global configuration

publisherAPI.adInfo ⇒ AdInfo

Combination of generic properties of all types of ads and custom properties that depend on VAST Extensions.

Kind: instance property of PublisherAPI
Returns: AdInfo - Represents static information about the current ad

publisherAPI.adInteractiveState ⇒ Boolean

Returns whether the current ad is interactive (most likely by using VPAID) or not.

Kind: instance property of PublisherAPI
Returns: Boolean - True if the current ad has been specified as interactive

publisherAPI.adCompanions ⇒ Array.<CompanionAd>

The value of this property is an Array that provides ad companion details for each <CompanionAd> element. The video player should request this value whenever it receives the ON_COMPANIONS_DETECTED event.

Kind: instance property of PublisherAPI
Returns: Array.<CompanionAd> - List of all companion ads

publisherAPI.adExtensions ⇒ Array.<Extension>

The value of this property is an Array that provides ad extension details for the <Extensions> element. The video player should request this value whenever it receives the ON_EXTENSIONS_DETECTED add-on event.

Kind: instance property of PublisherAPI
Returns: Array.<Extension> - List of all extensions

publisherAPI.initAdSlot(adBreak, environmentVars) ⇒ Promise

Invokes a commercial break by requesting the specified ad setup from the ad server.

Kind: instance method of PublisherAPI
Returns: Promise - Resolves if loading the ad manifests has been completed

Param Type Description
adBreak AdBreak Configuration for the upcoming ad break.
environmentVars EnvironmentVars Defines environment conditions for the upcoming ad break

publisherAPI.startAdSlot()

Starts the ad break. The add-on responds by sending an ON_AD_SLOT_START event notifying the video player the ad break is going to start.

Kind: instance method of PublisherAPI

publisherAPI.stopAdSlot()

Stops a running ad break. The add-on responds by sending an ON_AD_SLOT_COMPLETE event notifying the video player it has closed and cleaned up ad resources. Also the content of the video player has been reseted.

Kind: instance method of PublisherAPI

publisherAPI.skipAd()

Skips (stops) a running single ad The add-on respondes by sending the ON_AD_SKIPPED event notifying the video player it has closed and cleaned up a single ad.

_Note: The add-on does proceed with the next ad. Canceling the whole ad break requires calling stopAdSlot() instead.

Kind: instance method of PublisherAPI

publisherAPI.resize(boundingRectangle, viewMode)

Following a resize of the video player, the video player calls resize() to allow the add-on to scale and reposition itself within the display area. The add-on responds by sending an ON_AD_SIZE_CHANGED event.

Kind: instance method of PublisherAPI

Param Type Description
boundingRectangle Rectangle The video content display as a Rectangle {width, height, top, left}
viewMode string Current viewing mode (normal, fullscreen, thumbnail, dynamic)

publisherAPI.clickThrough(playerHandles) ⇒ string

Following a click on the ad, the video player calls clickThrough() to allow the add-on to request the advertisers landing page and call the ClickThru tracking requests.

Kind: instance method of PublisherAPI
Returns: string - The landing page URL.

Param Type Description
playerHandles Boolean Whether the player takes responsibility for opening the landing page URL. Defaulting to false if omitted.

publisherAPI.pauseAd()

Pauses the current ad break. The add-on responds by sending the ON_AD_PAUSED event.

Kind: instance method of PublisherAPI

publisherAPI.resumeAd()

Resumes the current ad break. The add-on responds by sending the ON_AD_PLAYING event.

Kind: instance method of PublisherAPI

AdBreak : Object

Definition of the upcoming ad slot.

Kind: global typedef
Properties

Name Type Description
tag string AdRequest URL
opener string
bumper string
closer string

EnvironmentVars : Object

Used for passing implementation-specific runtime variables.

Kind: global typedef
Properties

Name Type Description
desiredBitrate number Indicates the desired bitrate in kilobits per second (kbps). The player uses this information to select Mediafiles with an appropriate bitrate. Defaulting to null.
desiredMimeTypes Array Declaration of accepted media types. Defaulting to types that the browser eventually is able to play. Types must be compliant with the IANA Media Type standard
deviceType string Can be either mobile, tablet, desktop or tv. Defaulting to null.
deviceScreenSize Dimension Maximum size we can achieve when entering fullscreen.
networkReachability string Can be either wwan, wifi or unreachable. Defaulting to null.
vastMacroValues Object as defined by the VAST 4.1 specification.

Wrapper : Array

List of URLs that have been requested during a chain of ad server requests.

Kind: global typedef

UniversalAdID : Object

A unique creative ID for the ad across multiple systems.

Kind: global typedef
Properties

Name Type Description
idRegistry string A string used to identify the URL for the registry website where the unique creative ID is cataloged. Defaulting to unknown.
idValue string A string identifying the unique creative identifier. Defaulting to unknown.

AdInfo : Object

Collection of data that describes the current video ad.

Kind: global typedef
Properties

Name Type Description
adId string Value of the id attribute from the VAST > Ad node
title string Value of the VAST > Ad > AdTitle node
variant string Ad variant, depending on the current schedule and VAST manifest.
skippable Boolean The default value for this property is false. When the ad reaches a point where it can be skipped, the ad unit updates this property to true and sends the ON_AD_SKIPPABLE_STATE_CHANGE event. The video player can check this property at any time, but should always check it when the ON_AD_SKIPPABLE_STATE_CHANGE event is received.
currentClip number Index of the current ad, regardless of its variant.
totalClips number Total number of ads within the current ad break, regardless of variants.
currentCommercial number Index of the current ad of variant COMMERCIAL. Defaulting to -1
totalCommercials number Total number of ads with variant COMMERCIAL within the current ad break
totalCommercialsDuration number Total duration of ads with variant COMMERCIAL within the current ad break
totalCommercialsCurrentTime number Current time of all ads with variant COMMERCIAL within the current ad break
duration number Total time of the current ad
currentTime number Current time of the current ad
wrapperTags Array.<Wrapper> List of Wrapper URLs, starting with the initial request up to the last Wrapper before the Inline tag.
universalAdID UniversalAdID A unique creative identifier that is maintained across different ad systems.
errorCode number Code according to IAB VAST 4.0 Error Codes Table. Defaulting to '--' (no error).

CompanionAd : Object

Secondary ads included in the VAST tag that accompany the video ad.

Kind: global typedef
Properties

Name Type Description
type string Type of the companion creative resource. Can be either StaticResource, IFrameResource or HTMLResource
companionXML xml Full node.

Extension : Object

Custom XML element that extends the video ad.

Kind: global typedef
Properties

Name Type Description
type string The MIME type of any code that might be included in the extension. Type should be compliant with the IANA Media Type standard
extensionXML xml Full node.