Same as AdsManager.configureAdsManager() method.
Same as AdsManager.discardAdBreak() method.
Destroy the ad player instance. It stop and cleanup all internal instances and created DOM elements.
player.destroy() // This method may dispatch `ad_end` ad player event
Signals the video content is finished. This will allow to play post-roll ads (if any).
player.ended()
Same as AdsManager.focus() method.
Same as AdsManager.getAdSkippableState() method.
This method returns null if AdsManager instance is unavailable.
Same as AdsManager.getCuePoints() method.
This method returns null if AdsManager instance is unavailable.
Get the DOM element used to display the ads in. (The HTML element set in displayContainer
configuration option)
Same as AdsManager.getRemainingTime() method.
This method returns null if AdsManager instance is unavailable.
Same as AdsManager.getVolume() method.
This method returns null if AdsManager instance is unavailable.
Initialize the ad display container. This method must be called as the result of a user action.
It is automaticalled called by play() method, but may be usefull to call it before play() to store user interaction.
player.initAdDisplayContainer()
Same as AdsManager.isCustomClickTrackingUsed() method.
This method returns null if AdsManager instance is unavailable.
Same as AdsManager.isCustomPlaybackUsed() method.
This method returns null if AdsManager instance is unavailable.
Remove one or all event listener(s).
Name | Type | Description |
---|---|---|
name | string | The event name |
cb | Function | Optional listener callback function |
player.off('ad_begin', function(o) {/* ... */})
player.off('ad_begin') // Unbind all listeners
Add an event listener.
Name | type | Description |
---|---|---|
name | string | The event name |
cb | Function | The listener callback function |
player.on('ad_begin', function(o) {
/**
* o.name is event name
* o.data is event object (may equals undefined)
* o.target is ad player instance
*/
})
Same as AdsManager.pause() method.
Start the ad player. This method must be called as the result of a user action (if autoplay not permitted).
player.play()
Request ads from ad server. It is usefull, for example, to pre-request ads when autoplay is not allowed.
Name | Type | Description |
---|---|---|
options | object | Optional ads request properties defined in the IMA SDK documentation |
player.request()
// Overrides ads request properties set with "adsRequestOptions" configuration option
player.request({vastLoadTimeout: 10000})
Signals the ad player to resize the current ad.
Name | Type | Description |
---|---|---|
width | integer | The new width |
height | integer | The new height |
viewMode | integer | The optional new view mode. (default is google.ima.ViewMode.NORMAL) |
player.resize(320, 240)
Same as AdsManager.resume() method.
Same as adWillAutoPlay
configuration option. This method must be called before play() or request().
player.setAdWillAutoPlay(false)
Same as adWillPlayMuted
configuration option. This method must be called before play() or request().
player.setAdWillPlayMuted(true)
Same as continuousPlayback
configuration option. This method must be called before play() or request().
player.setContinuousPlayback(true)
Set the volume for the current ad.
Name | Type | Description |
---|---|---|
volume | number | Number value between 0 (mute) and 1 (loudest) |
player.setVolume(0.5)
Same as AdsManager.skip() method.
Stop the ad player.
player.stop()
Same as AdsManager.updateAdsRenderingSettings() method.