loadAdTag(tag)

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).

AttributeDescription
tag* stringVAST tag URL that should be loaded into the player

We recommend calling loadAdTag 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

πŸ“˜

loadAdTag 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.

loadAdTag is also not supported with ad preloading. Since calling loadAdTag immediately plays an ad, there is no time to preload an ad.