shouldPlaySeekedOverAdItems
Callback that selects which ad items should play after a forward seek or timeshift finishes.
When set, the callback receives every AdItem scheduled between the seek origin and the target position and must return the subset that should remain scheduled. Ad items that are not returned are discarded.
Default behavior
If no HLS interstitial ad items were seeked over, all seeked-over AdItems are played back.
If any HLS interstitial ad items were seeked-over:
If all of those interstitials are not jump-restricted (
X-RESTRICT="JUMP"), none of the seeked-over interstitials will play.Otherwise, only the last jump-restricted interstitial is played.
In both cases, seeked-over non-interstitial ad items are not played.
Discarded ad items are removed before loading. However, some might already be loaded when the seek finishes if:
a non-interstitial ad break was within its configured preload window, or
an HLS interstitial ad break time was already at the playback position.
Post and Pre-roll ad items cannot be seeked-over and therefore are never affected by this callback.
The callback is not invoked on source transitions i.e. seeking to a different source. The PlaylistTransition acts as a natural border for scheduled ads.
Example Usage
To always play only the last item after seeking or timeshifting over ad breaks:
AdvertisingConfig(
shouldPlaySeekedOverAdItems = ShouldPlaySeekedOverAdItemsCallback { adItems, context ->
adItems.takeLast(1)
}
)