videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
381 stars 257 forks source link

Detect when Server Side Ad is playing #507

Open samueleastdev opened 4 years ago

samueleastdev commented 4 years ago

How do you detect when a server-side ad is playing is this possible with this plugin?

Example here: https://b8478f1f82bb4ad1b117b36bdc953d43.mediatailor.us-east-1.amazonaws.com/v1/master/d02fedbbc5a68596164208dd24e9b48aa60dadc7/q2nvw3-1576620977/master.m3u8

Is there an event I can listen to something like.

player.on('adPlaying', function(_event) {
     // Update UI
});

Thanks

marguinbc commented 4 years ago

Hi @samueleastdev, there isn't really a way (in contrib-ads) to detect if server-side ads are playing but if you know you are only playing server-side ads, you can set the option stitchedAds:true in the contrib-ads-settings: http://videojs.github.io/videojs-contrib-ads/integrator/options.html

In fact, this is required to make sure ad events are fired and handled correctly.