Class: AdManager

Members

(static, constant) AdEventType :string

Ad event types.
Properties:
Name Value Type Description
AD_LIBRARY_CREATING adlibrarycreating string
AD_LIBRARY_CREATED adlibrarycreated string
AD_LIBRARY_DESTROYED adlibrarydestroyed string
AD_PODS_INFO adpodsinfo string The event has the adPodsInfo field with the cuepoints.
AD_BLOCK_STARTED adblockstarted string
AD_BLOCK_END adblockend string
AD_STARTED adstarted string
AD_LOADED adloaded string
AD_COMPLETED adcomplete string
AD_PAUSED adpaused string
AD_RESUMED adresumed string
AD_SKIPPED adskipped string
AD_FIRST_QUARTILE adfirstquartile string
AD_MID_POINT admidpoint string
AD_THIRD_QUARTILE adthirdquartile string
AD_IMPRESSION adimpression string
AD_ERROR aderror string The event has the imaError field with the error thrown by IMA.
AD_DURATION_CHANGED addurationchange string
AD_CLICKED adclick string
AD_MUTED advolumemuted string
AD_VOLUME_CHANGED advolumechanged string
AD_CLOSED adclosed string
AD_STOPPED adstopped string

Methods

addEventListener(type, listener)

Add an event listener to this object.
Parameters:
Name Type Description
type string The event type to listen for.
listener EventListener | function The callback or listener object to invoke.

getAdBreaks() → (non-null) {Array.<AdBreak>}

Returns the ad breaks positions.

getAdCurrentTime() → {number}

Returns the current time of this ad, or -1 for non-linear ads.

getAdDescription() → (nullable) {string}

Returns the description of this ad.

getAdDuration() → {number}

Returns the duration of this ad, or -1 for non-linear ads.

getAdId() → (nullable) {string}

Ad ID is used to synchronize main ad and companion ads.

getAdMediaElement() → (nullable) {HTMLMediaElement}

Returns the current media element used for the ads.

getAdPaused() → {boolean}

Returns true if the ad is paused.

getAdRemainingTime() → {number}

Returns the remaining time of this ad, or -1 for non-linear ads.

getAdTitle() → (nullable) {string}

Returns the title of this ad.

getAdvertiserName() → (nullable) {string}

The advertiser name as defined by the serving party.

getCreativeAdId() → (nullable) {string}

Returns the ISCI (Industry Standard Commercial Identifier) code for an ad, or empty string if the code is unavailable. This is the Ad-ID of the creative in the VAST response.

getIsSkippableAd() → (nullable) {boolean}

Returns true if the ad can currently be skipped.

getMediaUrl() → (nullable) {string}

Returns the URL of the media file chosen from the ad based on the media selection settings currently in use. Returns null if this information is unavailable.

getMute() → {boolean}

Returns true if the ad is muted.

getPositionInSequence() → (nullable) {number}

The position of the ad within the pod.

getSequenceLength() → (nullable) {number}

The total number of ads contained within this pod.

getTimeOffset() → {number}

Returns the content time offset at which the current ad pod was scheduled. For pods in VOD streams with dynamically inserted ads, stream time is returned. For preroll pod, 0 is returned. For midrolls, the scheduled time is returned. For postroll, -1 is returned. Defaults to 0 if this ad is not part of a pod, or the pod is not part of an ad playlist.

getVastMediaBitrate() → {number}

When both the creative and the media file have been selected by the IMA, this will return the bitrate for the media file as listed in the vast response.

getVastMediaHeight() → {number}

Returns the VAST media height.

getVastMediaWidth() → {number}

Returns the VAST media width.

getVolume() → {number}

Returns the volume of the ad.

isPaused() → (nullable) {boolean}

Returns true if the ad is paused.

isPlaying() → {boolean}

Returns true if the ad is loaded.

isPlayingIMA() → {boolean}

Returns true if the IMA ad is loaded.

listenToAllEvents(listener)

Add an event listener to this object that is invoked for all events types the object fires.
Parameters:
Name Type Description
listener EventListener | function The callback or listener object to invoke.

pause()

Pauses the current ad that is playing.

play()

Play the current ad that is loaded and paused.

removeEventListener(type, listener)

Remove an event listener from this object.
Parameters:
Name Type Description
type string The event type for which you wish to remove a listener.
listener EventListener | function The callback or listener object to remove.

requestClientSideAds(adTagUri, pageUrlopt)

Add a new Advertisement URL that is going to be played. VAST, VPAID, VMAP are supported. Note: only works with IMA adsMode.
Parameters:
Name Type Attributes Description
adTagUri string
pageUrl string <optional>

setMute(muted)

Set the mute for the ad.
Parameters:
Name Type Description
muted boolean

setVolume(volume)

Set the volume for the current ad.
Parameters:
Name Type Description
volume number The volume to set, from 0 (muted) to 1 (loudest).

skip()

Skips the current ad when getIsSkippableAd is true.