Used to play an ad immediately, which is primarily useful for situations where the built-in ad schedule of JW Player cannot be used (for example, for live streaming or dynamic ads for playlist items). This function is useful when you have already loaded the ad tag via some external mechanism and want to load the response into the player.
Attribute | Description |
---|---|
xml* string | The ad's VAST source code that should be loaded into the player |
We recommend calling loadAdXml
in the following situations:
- Inside a JW Player event handler for
beforePlay()
to trigger a pre-roll - Inside a JW Player event handler for
onTime()
to trigger a mid-roll - Inside an event handler for
on('BeforeComplete')
to trigger a post-roll - Outside of event handlers, only when the player is in the playing state
loadAdXml
is not supported when using Player Bidding due to the potential impact on performance and user experience while the player is waiting for the bidding process to complete.loadAdXml
is also not supported with ad preloading. Since callingloadAdXml
immediately plays an ad, there is no time to preload an ad.