Pause Ads
The Bitmovin Player Android SDK can present pause ads: non-linear ads that are shown while the viewer has the main content paused. A pause ad never interrupts playback. The viewer pauses, the ad is rendered over the paused player, and it is taken down when playback resumes.
Pause ads are scheduled through AdItem, but they are not anchored to the media timeline. Instead of a time, set AdItem.position to "pause".
For cross-platform context, see Pause Ads.
Pause ad support is experimental. The API may change in a future version.
Requirements
- Pause ads are resolved through Bitmovin Advertising. The ad source must use
AdSourceType.Bitmovin. Other ad source types are not supported - The VAST response must contain a
NonLinearAdscreative with aStaticResourcethat is animage/jpeg,image/jpgorimage/pngimage. Other resource types are not supported - An ad
ViewGroupmust be set.PlayerViewsets one automatically. Integrations that don't use the providedPlayerViewmust set one themselves for pause ads to work
Scheduling a pause ad
Schedule the ad upfront through AdvertisingConfig:
val pauseAd = AdItem(
sources = arrayOf(AdSource(AdSourceType.Bitmovin, "https://example.com/pause-ad-tag")),
position = "pause",
)
val player = Player(
context,
PlayerConfig(advertisingConfig = AdvertisingConfig(schedule = listOf(pauseAd))),
)Or schedule it at runtime through AdvertisingApi.schedule once a source is loaded:
player.ads.schedule(pauseAd)Pause ads are scoped to the playback session, not to a single source. A pause ad that has not been presented yet stays scheduled across a source transition, and one that has already been consumed does not become eligible again because the source changed.
Because a pause ad has no timeline position, it is not listed in AdvertisingApi.schedule and does not produce PlayerEvent.AdScheduleChanged entries.
Suppressing a pause ad
AdvertisingConfig.shouldLoadAdItem is called on every pause ad opportunity, before the ad tag is resolved. Returning false discards the pause ad for that opportunity only: nothing is presented, the ad stays scheduled, and the callback is asked again on the next pause. Use it to keep pause ads from being shown, for example for content or viewers that should not see them.
val advertisingConfig = AdvertisingConfig(
schedule = listOf(pauseAd),
shouldLoadAdItem = { adItem -> adItem.position != "pause" || shouldShowPauseAds() },
)AdvertisingConfig.shouldPlayAdBreak is not called for pause ads, as they are not part of an ad break.
Presentation
Once the content has stayed paused for the activation delay (one second, without seeking or time shifting), the player resolves the ad tag, selects a creative, and renders it.
The creative is drawn across the full ad ViewGroup, above the video and below the player UI, with its aspect ratio preserved. When you use PlayerView, the default Bitmovin Player UI hides its center play button while a pause ad is presented.
At most one pause ad is presented per pause. Closing the ad, resuming playback, or failing to load the ad consumes that opportunity, and no further pause ad is presented until playback resumes and is paused again. Nothing is preloaded or cached: to enable dynamic ad inventory, the tag is resolved again on every opportunity.
Ad view group
The ad ViewGroup is the container the creative is rendered into, and its bounds are what the best-fitting creative is selected against. A pause ad is only presented while one is set.
PlayerView sets the ad view group automatically. If you do not use PlayerView, or you want a customized experience, set your own through AdvertisingApi.setViewGroup:
player.ads.setViewGroup(customAdContainer)Closing a pause ad
AdvertisingApi.skip() closes a presented pause ad. The main content stays paused, and the current pause ad opportunity is consumed.
player.ads.skip()This has no effect while the creative is still loading, i.e., before PlayerEvent.NonLinearAdStarted is emitted.
The Bitmovin Player UI provides resume and close controls. If you build your own UI, make sure a resume control is always reachable while a pause ad is shown, and wire your close control to skip() so that the VAST close tracking is fired.
Events
PlayerEvent.NonLinearAdStarted: the creative is presentedPlayerEvent.NonLinearAdSkipped: the ad was explicitly closed throughskip()PlayerEvent.NonLinearAdFinished: the presentation ended in any other way, for example because the main content playback resumed
Every NonLinearAdStarted is followed by exactly one NonLinearAdSkipped or NonLinearAdFinished.
A pause ad is not an ad break, so it is not surrounded by PlayerEvent.AdBreakStarted and PlayerEvent.AdBreakFinished, and it does not emit the linear AdStarted / AdFinished events.
PlayerEvent.AdManifestLoad, PlayerEvent.AdManifestLoaded and PlayerEvent.AdError are also emitted for pause ads. For a non-linear ad, the ad config they report is a NonLinearAdConfig.
Linear-only APIs
Existing linear ad APIs deliberately exclude pause ads, so integrations built on them keep working unchanged:
| API | Behavior with pause ads |
|---|---|
Player.isAd | Stays false |
AdvertisingApi.activeAdBreak | Does not return the pause ad |
AdvertisingApi.activeLinearAd | Does not return the pause ad |
AdvertisingApi.schedule | The schedule list does not include pause ads |
| Ad break events | Not emitted |
Tracking
The following VAST tracking events are fired for pause ads:
| Situation | Tracking |
|---|---|
| Creative becomes visible | impression, creativeView |
| Viewer explicitly closes the ad | close |
| Presentation ends | overlayViewDuration |
| Loaded creative is discarded without ever being rendered | notUsed |
Resuming the content ends the presentation but does not fire close. Only an explicit close through skip() does.
Interaction with linear ads
Linear and pause ads are mutually exclusive. A pause ad is never loaded or rendered while a linear ad is active, even if the viewer pauses the linear ad.
Troubleshooting
If the selected creative cannot be fetched, the ad is not presented, and PlayerWarningCode.NonLinearAdCreativeFetchingFailed (1307) is emitted through PlayerEvent.Warning. Resolution failures are reported through PlayerEvent.AdError.
If no pause ad appears at all, check that an ad view group is set, that the ad source uses AdSourceType.Bitmovin, and that the VAST response contains a supported static image resource.
Creatives are fetched through the player's regular network stack, so any configured network hooks apply.
Limitations
- Ad pods are not supported. Only the first ad of the VAST response with a usable
NonLinearcreative is presented - Only static
image/jpeg,image/jpgandimage/pngresources are presented. SIMID, HTML and VPAID experiences are not supported - A loading failure does not fall back to another resource or variation from the same VAST response. Ad source waterfalls keep their normal fallback behavior
- The activation delay is fixed at one second and cannot be configured
- Preloading is not supported, and
AdItem.preloadOffsetis ignored for pause ads - Rendering is owned by the SDK. You can relocate the presentation with a custom ad view group, but you cannot render the creative yourself
Updated 1 minute ago