<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/Android-V4-009727?logo=android" style="float:left"/>
After [adding ads](🔗) to your content, you can define ad rules that control how often a viewer sees ads while viewing your video content. <b>Ad rules can be used only when using a VAST (</b>`
VastAdvertisingConfig`<b>) ad client</b>.
If you are publishing playlists that consist of short-duration videos, like tutorials or product reviews, you can define `
startOn` (the first playlist item allowing ad playback) and `
frequency` (the regularity of ads within a playlist).
If you are publishing long-form content, like webinars or interviews, you can define `
startOnSeek` (which determines if a returning visitor is served a pre-roll ad before resuming content playback) and `
timeBetweenAds` (which sets the minimum time that must elapse between ads playback).
You can read <a href="https://docs.jwplayer.com/platform/docs/ad-rules-reference" target="_blank">Ad rules reference</a> to learn more about how each ad rule impacts a user's experience.
<br /> <hr />
Use the following steps and code samples to define ad rules:
Create an `
AdRules` object and name it, for example, `
Configure the properties of the `
adRules` object for your use case.
adRules` to `
<br /> <hr />
### Example 1: Short-form content
The following example illustrates a short-form media item with a pre-roll ad. The first ad plays before the first playlist item (`
startOn: 1`). Then, subsequent pre-roll ads appear for every third playlist item (`
frequency: 3`), starting with the fourth playlist item.
### Example 2: Long-form content
The following example illustrates a long-form media item with multiple ad breaks. The `
startOnSeek` and `
timeBetweenAds` (set to 300 seconds) ad rules have been defined.