-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Resolve dangling endLinearAdMode call in onAdBreakEnd. #574
Conversation
We don't want this call to happen after post-rolls. This fixes that.
I tried this solution, but it does not stop contrib-ads from firing after all ads completed. When I change source (to related video) after postroll and this next video ends, there is again postroll timeout without ad. Something is still wrong. I did it like this:
And from some reason, it works as expected (without warnings and without unexpected timeouts on playlist). Thats why I mentioned incompl Maybe he can explain that behaviour. |
Is the difference in your code snippet just that you're always calling endLinearAdMode in reset(), regardless of whether or not you're currently in an ad break? I think it still makes sense to check, since we shouldn't be ending linear ad mode if we're not actually in linear ad mode. |
Yes. What you say make sense and your current fix was also first thing I did when trying to make it work. It works with one video (repeating, seeking backwards..), but it triggers postroll timeout on next one. Dunno why.. contrib-ads doc says:
So I would expect that after ended event, ads goes off. There must be some unfinished bussiness or nvm. Btw. I serve next video via player.src() and source interceptor. |
Hmm if you're accessing player.src directly that could be an issue - it can mess with videojs-ima's internal state machine. Have you tried using player.ima.setContentWithAdTag instead? You can provide null or an empty string for the adTag if you want to use the same one again. |
Do you think that handling player via ima plugin is good idea? Because related videos are displayed at the end of video playback when all ads are finished. Currently we dont need ads on every item in playlist. Also there are cases where ima plugin may not be registered to the player so it chains dependency on inactive ima plugin -> sdk -> contrib-ads -> which leads to if-else handling. The point is that it doesnt trigger on other videos with contrib-ads v5 and it does with v6. I will look into contrib-ads, but I have feeling that it is related to startLinearAdMode/endLinearAdMode and that endLinearAdMode is not called after postroll. Maybe there can be another case than ads.inAdBreak(). |
We maintain our own state machine that depends on knowing when the source of the player changes, so we added a method to pass through the source to the player. We could update it to instead rely on events from the player, but that has the potential to be much more buggy and wouldn't tie together the process of setting the content source and the ad tag. |
For that purpose, I still use this as part of source interceptor: https://github.com/videojs/videojs-contrib-ads#contentsrc. For now, feel free to merge and close this. I will look into the code and open new issue if I find something interesting. Thanks. |
When I think about it, it could be also my fault because now I am not sure that |
Ok. So your pull is absolutely correct. player.currentSrc() is actually not current h5player src, but value from internal videojs cache. And I forgot to update this value during manupulation with source. Sorry for such false alarm. |
No worries, thanks! |
…oogleads#574)" This reverts commit 2158ba0. breaks compatibility to `videojs-contrib-ads` v4
We don't want this call to happen after post-rolls. This fixes that.
Addresses #539