stormcloud-video-player 0.3.12 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +32 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +32 -5
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +32 -5
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +32 -5
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +32 -5
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +17 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +32 -5
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -922,6 +922,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
922
922
|
let sessionId;
|
|
923
923
|
const preloadedAds = /* @__PURE__ */ new Map();
|
|
924
924
|
const preloadingAds = /* @__PURE__ */ new Map();
|
|
925
|
+
let destroyed = false;
|
|
926
|
+
let pendingTimeouts = [];
|
|
925
927
|
let trackingFired = {
|
|
926
928
|
impression: false,
|
|
927
929
|
start: false,
|
|
@@ -1250,7 +1252,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1250
1252
|
adPlaying = false;
|
|
1251
1253
|
setAdPlayingFlag(false);
|
|
1252
1254
|
emit("content_resume");
|
|
1253
|
-
setTimeout(() => {
|
|
1255
|
+
const timeoutId = window.setTimeout(() => {
|
|
1256
|
+
if (destroyed) {
|
|
1257
|
+
console.log("[HlsAdPlayer] Player destroyed, skipping post-completion check");
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1254
1260
|
const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
|
|
1255
1261
|
if (stillInPod) {
|
|
1256
1262
|
console.log(
|
|
@@ -1261,7 +1267,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1261
1267
|
adContainerEl.style.pointerEvents = "auto";
|
|
1262
1268
|
}
|
|
1263
1269
|
}
|
|
1270
|
+
const idx = pendingTimeouts.indexOf(timeoutId);
|
|
1271
|
+
if (idx !== -1) {
|
|
1272
|
+
pendingTimeouts.splice(idx, 1);
|
|
1273
|
+
}
|
|
1264
1274
|
}, 50);
|
|
1275
|
+
pendingTimeouts.push(timeoutId);
|
|
1265
1276
|
}
|
|
1266
1277
|
function handleAdError() {
|
|
1267
1278
|
console.log("[HlsAdPlayer] Handling ad error");
|
|
@@ -1491,6 +1502,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1491
1502
|
},
|
|
1492
1503
|
destroy() {
|
|
1493
1504
|
console.log("[HlsAdPlayer] Destroying");
|
|
1505
|
+
destroyed = true;
|
|
1506
|
+
for (const timeoutId of pendingTimeouts) {
|
|
1507
|
+
clearTimeout(timeoutId);
|
|
1508
|
+
}
|
|
1509
|
+
pendingTimeouts = [];
|
|
1494
1510
|
adPlaying = false;
|
|
1495
1511
|
setAdPlayingFlag(false);
|
|
1496
1512
|
contentVideo.muted = originalMutedState;
|
|
@@ -2403,10 +2419,11 @@ var StormcloudVideoPlayer = class {
|
|
|
2403
2419
|
this.handleAdPodComplete();
|
|
2404
2420
|
}
|
|
2405
2421
|
});
|
|
2406
|
-
this.
|
|
2422
|
+
this.timeUpdateHandler = () => {
|
|
2407
2423
|
this.onTimeUpdate(this.video.currentTime);
|
|
2408
|
-
}
|
|
2409
|
-
this.video.addEventListener("
|
|
2424
|
+
};
|
|
2425
|
+
this.video.addEventListener("timeupdate", this.timeUpdateHandler);
|
|
2426
|
+
this.emptiedHandler = () => {
|
|
2410
2427
|
if (this.nativeHlsMode && this.videoSrcProtection && !this.ima.isAdPlaying()) {
|
|
2411
2428
|
if (this.config.debugAdTiming) {
|
|
2412
2429
|
console.log(
|
|
@@ -2423,7 +2440,8 @@ var StormcloudVideoPlayer = class {
|
|
|
2423
2440
|
});
|
|
2424
2441
|
}
|
|
2425
2442
|
}
|
|
2426
|
-
}
|
|
2443
|
+
};
|
|
2444
|
+
this.video.addEventListener("emptied", this.emptiedHandler);
|
|
2427
2445
|
}
|
|
2428
2446
|
shouldUseNativeHls() {
|
|
2429
2447
|
const streamType = this.getStreamType();
|
|
@@ -4059,6 +4077,15 @@ var StormcloudVideoPlayer = class {
|
|
|
4059
4077
|
this.clearAdStartTimer();
|
|
4060
4078
|
this.clearAdStopTimer();
|
|
4061
4079
|
this.clearAdFailsafeTimer();
|
|
4080
|
+
this.clearAdRequestWatchdog();
|
|
4081
|
+
if (this.timeUpdateHandler) {
|
|
4082
|
+
this.video.removeEventListener("timeupdate", this.timeUpdateHandler);
|
|
4083
|
+
delete this.timeUpdateHandler;
|
|
4084
|
+
}
|
|
4085
|
+
if (this.emptiedHandler) {
|
|
4086
|
+
this.video.removeEventListener("emptied", this.emptiedHandler);
|
|
4087
|
+
delete this.emptiedHandler;
|
|
4088
|
+
}
|
|
4062
4089
|
if (this.heartbeatInterval) {
|
|
4063
4090
|
clearInterval(this.heartbeatInterval);
|
|
4064
4091
|
this.heartbeatInterval = void 0;
|