Exception when HLS/DASH chunks are requested before the ad returns from the broker
nepomucenobr opened this issue · 1 comments
Description
I wrote a proof of concept FreeWheel plugin and it works fine for progressive streams. However, it fails when I use HLS/DASH (I see an error on the console and when the ad finishes, the regular video won’t play). I noticed it happens when the ad broker takes a bit of time to return something. I tested it with two ad servers, one that returns a fake ad right away and another one that goes through the bidding process with lots of fallbacks and all. It works fine for the first one, but fails for the second. Looking at the network tab, I noticed it fails when the player starts requesting the video chunks before the ad comes back from the broker (it works perfectly, otherwise). Apparently what’s happening is the player starts requesting the HLS/DASH video chunks and when it gets the ad, the video source is changed. Then, when the chunks arrive, the player says: “oh wait, I don’t know what to do with these anymore, I am playing something else now”. I am not sure if this is a bug with the videojs-contrib-ads plugin or if I should be calling something I am not.
Below you will find some information about how I am handling/triggering the main events associated with ad playback.
onRequestComplete = function(evt) {
if (evt.success) {
// (...)
if (temporalSlots.length && player.fw.prerollSlots.length) {
player.trigger("adsready");
}
else {
player.trigger("nopreroll");
}
}
},
playAd = function() {
if (player.fw.prerollSlots.length) {
player.ads.startLinearAdMode();
state.adPlaying = true;
player.trigger('ads-ad-started'); // I also tried placing this after the slot.play(), but it didn't work either
var slot = player.fw.prerollSlots.shift();
slot.play();
}
else {
player.trigger('ads-ad-ended');
player.ads.endLinearAdMode();
state.adPlaying = false;
}
}
Here is the actual error I am getting: Uncaught DOMException: Failed to read the ‘buffered’ property from ‘SourceBuffer’: This SourceBuffer has been removed from the parent media source.
Versions
videojs-contrib-ads version: 6.6.4
Video-js version: Video.js 7.6.0
Other plugins:
- videojs/http-streaming (version 1.10.3)
- I am using FreeWheel admanager library to handle ad requests/playback (http://adm.fwmrm.net/p/vitest-js/AdManager.js; version 6.23)
Platforms
Browsers: Chrome 76.0.3809.132 and Microsoft Edge 44.17763.1.0 (Microsoft EdgeHTML 18.17763)
OS/Devices: Windows 10
@nepomucenobr Any progress on this? I'm having the same issue. Also trying to use freewheel