The Bitmovin Player SDKs are capable of displaying Ads out of the box and there are two ways they can be configured with the player. One option is to use static configuration in the player config object, and the other is to schedule them dynamically using `Player.scheduleAd`.

## Static Ad configuration

The easiest way to configure Ads is by adding the `advertisingConfig` property to the player configuration object. All that needs to be provided is a URL pointing to a target Ad tag along with the type of the tag.

The possible `AdItem`.`position` values are:

  • `pre`: pre-roll ad (for VoD and Live streaming; appears before playback starts)

  • `post`: post-roll ad (for VoD streaming only; appears after playback finishes)

  • Fractional seconds: e.g. `10`, `12.5` (mid-roll ad, for VoD and Live streaming)

  • Percentage of the entire video duration: e.g. `25%`, `50%` (mid-roll ad, for VoD streaming only)

  • Timecode `hh:mm:ss.mmm:` e.g. `00:10:30.000`, `01:00:00.000` (mid-roll ad, for VoD streaming only)

## Dynamic Ad scheduling

To gain more flexibility, it is also possible to schedule an `AdItem` dynamically in code using the Player instance. To do this, you need to call the `scheduleAd` method.

An `AdScheduledEvent` is dispatched when the ad is successfully scheduled via `scheduleAd`.

Also, during playback, it's also possible to check whether an ad is being played with `player.isAd()` and skip the ad being currently played with `player.skipAd()` (see `AdSkippedEvent`).

## Supported ad-related events

The supported `PlayerView` events for ads are:

  • `onAdBreakFinished`

  • `onAdBreakStarted`

  • `onAdClicked`

  • `onAdError`

  • `onAdFinished`

  • `onAdManifestLoad`

  • `onAdManifestLoaded`

  • `onAdQuartile`

  • `onAdScheduled`

  • `onAdSkipped`

  • `onAdStarted`

You can find a complete Ads example in the [example app](🔗).