Closed mysuf closed 5 years ago
In your integration, would it work to set player.ads.snapshot.currentTime = time
on adstart
?
@incompl The issue with adstart is that it triggers multiple times during content playback and also .one
is not solution because there might be no preroll at all.
This is my current integration:
player.on(['loadedmetadata', 'contentloadedmetadata'] , function() {
player.one('playing', () => player.currentTime(lastTime||0));
});
The downside of this solution is that it seeks after preroll so mostly its not buffered and loading spinner shows on top..
It's interesting that you get adstart events during content playback, the only place in videojs-contrib-ads where adstart is triggered is when handling the start of an ad break. Do you know where those other adstarts are coming from?
@incompl I mean adstart for preroll, each midroll and last for postroll.
Would it work to check player.ads.adType
in your adstart handler to verify it's a preroll?
I'm not sure if there wasnt some event race condition on setting currentTime. I tried many ways but its already some time when I solved it. I'll give a try. Thanks
Got it working? 🤞
@incompl I'll find out on Monday and let you know (and possibly reopen if not). thx
My player currently saves time played to continue watching, but I would like to play also preroll before. Now it gets and sets currentTime() on loadedmetadata event which skips preroll (ima sdk evaluates that probably as "expired" when current time misses some time window), but occurs before currentTime is snapshoted so it properly seeks after preroll.
Question: is there way or workaround how to play preroll and also set snapshot's currentTime > 0.0 (offset) ? Thanks
Edit: Just found probably bug in debug mode. When debug is true, it skips preroll/postroll, plays content video, throws adtimeout and preserve loading spinner on top.. With debug off, it behaves as expected.
Edit2: Just found another bug. contrib-ads does not reset properly when adtimeout is pending and source is changed. After contentupdate, it plays preroll but does not switch back to content.. Log: