-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
Thanks for the great work on this plugin. I'm currently integrating it into a Video.js player with an HLS live stream as the main content in next.js. However, I'm facing a breaking issue when trying to play a VAST ad before the live stream starts.
π Problem Description
When using the plugin with a live .m3u8 HLS stream, the player fails to resume playback after the ad ends. Instead, I get the following error in the console:
java
Copy
Edit
VIDEOJS: ERROR: TypeError: Cannot read properties of undefined (reading 'suppressedTracks')
at restorePlayerSnapshot (videojs-contrib-ads.es.js:1569:41)
This error seems to be related to the snapshot restoration logic used by videojs-contrib-ads, which assumes that a suppressedTracks array exists β something that appears to be missing or invalid when using a live HLS stream as the main source.
π‘ Expected Behavior
After the VAST ad finishes, the live stream should resume automatically, without breaking or throwing errors.
βοΈ Environment
"@arte/videojs-vast": "^1.4.0",
"next": "14.2.2",
"video.js": "^8.18.1",
Stream type: HLS (Live)
CODE :
`const vastVjsOptions = {
vastUrl: advertisment.adsWebLink,
timeout: 5000,
verificationTimeout: 2000,
skipButtonOptions: {
text: "skip ADS",
},
};
player.vast(vastVjsOptions);
player.src({
src: link,
type: "application/x-mpegURL",
});
player.on("adplay", () => {
console.log("adsPlaying");
setAdsPlaying(true);
});
player.on("adpause", () => {
player.play();
});
player.on("vast.play", (event, data) => {
console.log("VAST ad is playing");
player.controls(false);
setAdsPlaying(true);
});
player.on("adended", () => {
console.log("VAST ad adended");
player.controls(true);
setAdsPlaying(false);
player.play();
});
player.on("vast.skip", () => {
console.log("VAST ad skip");
player.controls(true);
setAdsPlaying(false);
});`