---
updatedAt: 2026-09-10T12:52:17.000Z
agentTools:
  siteIndex: https://docs.jwplayer.com/llms.txt
  projectIndex: https://docs.jwplayer.com/players/llms.txt
---

# playAd(tag)

<Callout icon="🚧" theme="warn">
  Since `playAd(tag)` will be deprecated as of JW 8.31.0, use <a href="https://docs.jwplayer.com/players/reference/loadadtagtag" target="_blank">loadAdTag(tag)</a>.
</Callout>

Used to play an ad immediately, which is primarily useful for situations where the built-in ad schedule of the JWX player cannot be used. (e.g. for live streaming or dynamic ads for playlist items)

| Attribute                                           | Description                                        |
| --------------------------------------------------- | -------------------------------------------------- |
| **tag**<span style="color:red">**\***</span> string | VAST tag URL that should be loaded into the player |

<br />

We recommend to call `playAd()` in one of these following situations:

* Inside a JWX player event handler for `beforePlay()` to trigger a pre-roll
* Inside a JWX 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

<span class="manual-tbl-font">

 <Callout icon="📘" theme="info">
 `playAd()` 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.<br /><br />`playAd()` is also not supported with ad preloading. Since calling `playAd()` immediately plays an ad, there is no time to preload an ad.
 </Callout>

</span>

<HTMLBlock>{`

<style>
.rm-Pagination {
  display: none;
}
</style>
`}</HTMLBlock>

# Sibling pages

* [getAdBlock()](https://docs.jwplayer.com/players/reference/getadblock.md)
* [pauseAd(state)](https://docs.jwplayer.com/players/reference/pauseadstate.md)
* [loadAdTag(tag)](https://docs.jwplayer.com/players/reference/loadadtagtag.md)
* [loadAdXml(xml)](https://docs.jwplayer.com/players/reference/loadadxmlxml.md)
* [skipAd()](https://docs.jwplayer.com/players/reference/skipad.md)
* [skipAdBreak()](https://docs.jwplayer.com/players/reference/skipadbreak.md)
* [Advertising Events](https://docs.jwplayer.com/players/reference/advertising-events.md)