philipwatson / videojsx-vast-plugin

A video.js plugin to allow the player to serve adverts using VAST
Other
32 stars 23 forks source link

When switching video quality, the video starts from the beginning instead of continuing from the same point. #43

Open Alexander-Kane opened 1 month ago

Alexander-Kane commented 1 month ago

Hello.

First I would like to thank the author for the wonderful plugin, great job, thank you very much!

I have encountered a small bug. I am using videojs-quality-selector plugin to switch video quality. The plugin works fine, when I switch the video quality, the video continues from the same point. However, after connecting the videojsx-vast-plugin, when I switch the video quality, the video starts playing from the beginning. Can anyone tell me how to solve this problem? Thanks a lot!

philipwatson commented 1 month ago

Hi @Alexander-Kane

I found the problem in the code. Not sure how to tackle it yet. I haven't really considered the scenario where the website changes the video source. Usually a player will request another VAST and show a new preroll etc. But in your situation, it's the same content but different quality.

In meantime, try adding this line before calling the vast method player.vast({/*your config here*/});:

player.on("loadstart", function() {
    player.ads.contentSrc = player.currentSrc();
});

Does it work for you?