Skip to content

Commit

Permalink
docs(Ads): Add new use case to Ads documentation (#7642)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Nov 27, 2024
1 parent e9c8261 commit c21c956
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/tutorials/ad_monetization.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@ adManager.addCustomInterstitial({
});
```

You can also use this with SCTE-35:

```js
const adManager = player.getAdManager();
const video = document.getElementById('video');
const ui = video['ui'];
// If you're using a non-UI build, this is the div you'll need to create
// for your layout. The ad manager will clear this div, when it unloads, so
// don't pass in a div that contains non-ad elements.
const container = video.ui.getControls().getClientSideAdContainer();
adManager.initInterstitial(container, player, video);
player.addEventListener('timelineregionadded', (e) => {
const event = e.detail;
if (event.schemeIdUri != 'urn:scte:scte35:2014:xml+bin') {
return;
}
adManager.addCustomInterstitial({
id: event.id,
startTime: event.startTime,
endTime: event.endTime,
uri: 'YOUR_URL',
isSkippable: false,
skipOffset: null,
skipFor: null,
canJump: true,
resumeOffset: player.isLive() ? null : 0,
playoutLimit: null,
once: false,
pre: false,
post: false,
timelineRange: player.isLive(), // If true, the ad will appear as a range on the timeline.
});
});
```


##### VAST/VMAP (playback without tracking)

Expand Down

0 comments on commit c21c956

Please sign in to comment.