Class: AdsManager

Methods

collapse

collapse()

Collapse the current ad. This is no-op for HTML5 SDK.

configureAdsManager

configureAdsManager(content, adsRenderingSettings)

Sets required parameters for getting a reference to this AdManager from the AdsManagerLoaded event.

Parameter

content

Object

Object that plays back publisher's content.

Value must not be null.

adsRenderingSettings

Optional

AdsRenderingSettings

Optional settings to control the rendering of ads.

Value may be null.

destroy

destroy()

Removes ad assets loaded at runtime that need to be properly removed at the time of ad completion and stops the ad and all tracking.

discardAdBreak

discardAdBreak()

If an ad break is currently playing, discard it and resume content. Otherwise, ignore the next scheduled ad break. For example, this can be called immediately after the ads manager loads to ignore a preroll without losing future midrolls or postrolls. This is a no-op unless the ad request returned a playlist or VMAP response.

expand

expand()

Expand the current ad. This is no-op for HTML5 SDK.

focus

focus()

Puts the focus on the skip button, if present. If not present, focus is put on interactive elements, including icons or interactive creatives.

getAdSkippableState

getAdSkippableState() returns boolean

Returns true if the ad can currently be skipped. When this value changes, the AdsManager fires an AdEvent.SKIPPABLE_STATE_CHANGED event.

Returns

boolean True if the ad can currently be skipped, false otherwise.

getCuePoints

getCuePoints() returns Array of number

Returns an array of offsets in seconds indicating when a scheduled ad break will play. A preroll is represented by 0, and a postroll is represented by -1. An empty array indicates the ad or ad pod has no schedule and can be played at any time.

Returns

non-null Array of number List of time offsets in seconds.

getRemainingTime

getRemainingTime() returns number

Get the remaining time of the current ad that is playing. If the ad is not loaded yet or has finished playing, the API would return -1.

Returns

number Returns the time remaining for current ad. If the remaining time is undefined for the current ad (for example custom ads), the value returns -1.

getVolume

getVolume() returns number

Get the volume for the current ad.

Returns

number The volume of the current ad, from 0 (muted) to 1 (loudest).

init

init(width, height, viewMode, videoElement)

Call init to initialize the ad experience on the ads manager.

Parameter

width

number

The chosen width of the ad.

height

number

The chosen height of the ad.

viewMode

ViewMode

The chosen view mode.

Value must not be null.

videoElement

Optional

HTMLVideoElement

The video element for custom playback. This video element overrides the one provided in the AdDisplayContainer constructor. Only use this property if absolutely necessary - otherwise we recommend specifying this video element while creating the AdDisplayContainer.

Value may be null.

isCustomClickTrackingUsed

isCustomClickTrackingUsed() returns boolean

Returns true if a custom click tracking element is being used for click tracking on the current ad. Custom click tracking is only used when an optional click tracking element is provided to the AdDisplayContainer, custom playback is used, and the current ad is not an AdSense/AdX ad.

Returns

boolean Whether custom click tracking is used.

isCustomPlaybackUsed

isCustomPlaybackUsed() returns boolean

Returns true if a custom video element is being used to play the current ad. Custom playback occurs when an optional video element is provided to the AdDisplayContainer on platforms where a custom video element would provide a more seamless ad viewing experience.

Returns

boolean Whether custom playback is used.

pause

pause()

Pauses the current ad that is playing. This function will be no-op when a static overlay is being shown or if the ad is not loaded yet or is done playing.

resize

resize(width, height, viewMode)

Resizes the current ad.

Parameter

width

number

New ad slot width.

height

number

New ad slot height.

viewMode

ViewMode

The new view mode.

Value must not be null.

resume

resume()

Resumes the current ad that is loaded and paused. This function will be no-op when a static overlay is being shown or if the ad is not loaded yet or is done playing.

setVolume

setVolume(volume)

Set the volume for the current ad.

Parameter

volume

number

The volume to set, from 0 (muted) to 1 (loudest).

skip

skip()

Skips the current ad when AdsManager.getAdSkippableState() is true. When called under other circumstances, skip has no effect. After the skip is completed the AdsManager fires an AdEvent.SKIPPED event.

start

start()

Start playing the ads.

Developers must call AdDisplayContainer.initialize() first.

stop

stop()

Stop playing the ads. Calling this will get publisher back to the content.

updateAdsRenderingSettings

updateAdsRenderingSettings(adsRenderingSettings)

Updates the ads rendering settings. This should be used specifically for VMAP use cases between ad breaks when ads rendering settings such as bitrate need to be updated.

Parameter

adsRenderingSettings

AdsRenderingSettings

The updated ads rendering settings.

Value must not be null.