stormcloud-video-player 0.2.35 → 0.2.36
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 +48 -58
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +0 -3
- package/lib/index.d.ts +0 -3
- package/lib/index.js +48 -58
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +48 -58
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +0 -3
- package/lib/players/HlsPlayer.cjs +48 -58
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +48 -58
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/ima.cjs +1 -10
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +48 -58
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -628,19 +628,10 @@ function createImaController(video, options) {
|
|
|
628
628
|
adsManager.addEventListener(
|
|
629
629
|
AdEvent.CONTENT_PAUSE_REQUESTED,
|
|
630
630
|
() => {
|
|
631
|
-
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad
|
|
631
|
+
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad request accepted");
|
|
632
632
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
633
633
|
video.pause();
|
|
634
634
|
}
|
|
635
|
-
hideContentVideo();
|
|
636
|
-
if (adContainerEl) {
|
|
637
|
-
adContainerEl.style.pointerEvents = "auto";
|
|
638
|
-
adContainerEl.style.display = "flex";
|
|
639
|
-
adContainerEl.style.backgroundColor = "#000";
|
|
640
|
-
adContainerEl.offsetHeight;
|
|
641
|
-
adContainerEl.style.opacity = "1";
|
|
642
|
-
console.log("[DEBUG-LAYER] \u{1F7E1} Ad container VISIBLE");
|
|
643
|
-
}
|
|
644
635
|
adPlaying = true;
|
|
645
636
|
setAdPlayingFlag(true);
|
|
646
637
|
emit("content_pause");
|
|
@@ -2473,7 +2464,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2473
2464
|
this.clearAdRequestWatchdog();
|
|
2474
2465
|
this.activeAdRequestToken = null;
|
|
2475
2466
|
this.showAds = true;
|
|
2476
|
-
|
|
2467
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=hidden, Ad=visible, Placeholder=no");
|
|
2477
2468
|
});
|
|
2478
2469
|
this.ima.on("content_resume", () => {
|
|
2479
2470
|
console.log(`[DEBUG-POD] \u23F8\uFE0F content_resume | ad ${this.currentAdIndex}/${this.totalAdsInBreak}, queue=${this.adPodQueue.length}, remaining=${this.getRemainingAdMs()}ms`);
|
|
@@ -2653,6 +2644,12 @@ var StormcloudVideoPlayer = class {
|
|
|
2653
2644
|
});
|
|
2654
2645
|
}
|
|
2655
2646
|
if (marker.type === "start") {
|
|
2647
|
+
if (this.inAdBreak) {
|
|
2648
|
+
console.log(
|
|
2649
|
+
`[DEBUG-POD] \u26A0\uFE0F SCTE-35 start marker ignored - already in ad break (currentTime: ${this.video.currentTime})`
|
|
2650
|
+
);
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2656
2653
|
this.inAdBreak = true;
|
|
2657
2654
|
const durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
2658
2655
|
this.expectedAdBreakDurationMs = durationMs;
|
|
@@ -2719,6 +2716,9 @@ var StormcloudVideoPlayer = class {
|
|
|
2719
2716
|
return;
|
|
2720
2717
|
}
|
|
2721
2718
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
2719
|
+
console.log(
|
|
2720
|
+
`[DEBUG-POD] \u{1F4CA} SCTE-35 progress marker (currentTime: ${this.video.currentTime})`
|
|
2721
|
+
);
|
|
2722
2722
|
if (marker.durationSeconds != null) {
|
|
2723
2723
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
2724
2724
|
}
|
|
@@ -2730,7 +2730,8 @@ var StormcloudVideoPlayer = class {
|
|
|
2730
2730
|
);
|
|
2731
2731
|
this.scheduleAdStopCountdown(remainingMs);
|
|
2732
2732
|
}
|
|
2733
|
-
if (!this.ima.isAdPlaying()) {
|
|
2733
|
+
if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null) {
|
|
2734
|
+
console.log("[DEBUG-POD] \u{1F4CA} Progress marker: no ad playing, attempting to start");
|
|
2734
2735
|
const scheduled = this.findCurrentOrNextBreak(
|
|
2735
2736
|
this.video.currentTime * 1e3
|
|
2736
2737
|
);
|
|
@@ -2739,25 +2740,31 @@ var StormcloudVideoPlayer = class {
|
|
|
2739
2740
|
const first = tags[0];
|
|
2740
2741
|
const rest = tags.slice(1);
|
|
2741
2742
|
this.adPodQueue = rest;
|
|
2742
|
-
if (!this.showAds) {
|
|
2743
|
-
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
2744
|
-
}
|
|
2745
2743
|
this.playSingleAd(first).catch(() => {
|
|
2746
2744
|
});
|
|
2747
2745
|
}
|
|
2746
|
+
} else {
|
|
2747
|
+
console.log(
|
|
2748
|
+
`[DEBUG-POD] \u{1F4CA} Progress marker: ad playing or request active (playing=${this.ima.isAdPlaying()}, token=${this.activeAdRequestToken})`
|
|
2749
|
+
);
|
|
2748
2750
|
}
|
|
2749
2751
|
return;
|
|
2750
2752
|
}
|
|
2751
2753
|
if (marker.type === "end") {
|
|
2754
|
+
console.log(
|
|
2755
|
+
`[DEBUG-POD] \u{1F3C1} SCTE-35 end marker received (currentTime: ${this.video.currentTime})`
|
|
2756
|
+
);
|
|
2752
2757
|
this.inAdBreak = false;
|
|
2753
2758
|
this.expectedAdBreakDurationMs = void 0;
|
|
2754
2759
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
2755
2760
|
this.clearAdStartTimer();
|
|
2756
2761
|
this.clearAdStopTimer();
|
|
2757
2762
|
if (this.ima.isAdPlaying()) {
|
|
2763
|
+
console.log("[DEBUG-POD] \u{1F6D1} Stopping ad due to SCTE-35 end marker");
|
|
2758
2764
|
this.ima.stop().catch(() => {
|
|
2759
2765
|
});
|
|
2760
2766
|
}
|
|
2767
|
+
this.handleAdPodComplete();
|
|
2761
2768
|
return;
|
|
2762
2769
|
}
|
|
2763
2770
|
}
|
|
@@ -3088,10 +3095,12 @@ var StormcloudVideoPlayer = class {
|
|
|
3088
3095
|
this.vastToMediaUrlMap.clear();
|
|
3089
3096
|
this.preloadedMediaUrls.clear();
|
|
3090
3097
|
this.preloadingMediaUrls.clear();
|
|
3098
|
+
const currentMuted = this.video.muted;
|
|
3099
|
+
const currentVolume = this.video.volume;
|
|
3091
3100
|
console.log(
|
|
3092
|
-
`[DEBUG-AUDIO] \u{1F4BE} Capturing
|
|
3101
|
+
`[DEBUG-AUDIO] \u{1F4BE} Capturing ORIGINAL state (once) | muted=${currentMuted}, volume=${currentVolume}`
|
|
3093
3102
|
);
|
|
3094
|
-
this.ima.updateOriginalMutedState(
|
|
3103
|
+
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
3095
3104
|
this.inAdBreak = true;
|
|
3096
3105
|
this.currentAdIndex = 0;
|
|
3097
3106
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
@@ -3305,7 +3314,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3305
3314
|
this.clearAdRequestWatchdog();
|
|
3306
3315
|
this.clearAdFailsafeTimer();
|
|
3307
3316
|
this.activeAdRequestToken = null;
|
|
3308
|
-
this.releaseAdHoldState();
|
|
3309
3317
|
this.preloadingAdUrls.clear();
|
|
3310
3318
|
this.vastToMediaUrlMap.clear();
|
|
3311
3319
|
this.preloadedMediaUrls.clear();
|
|
@@ -3322,13 +3330,18 @@ var StormcloudVideoPlayer = class {
|
|
|
3322
3330
|
this.totalAdsInBreak = 0;
|
|
3323
3331
|
this.ima.stop().catch(() => {
|
|
3324
3332
|
});
|
|
3325
|
-
const
|
|
3326
|
-
const
|
|
3327
|
-
this.video.muted = originalMutedState;
|
|
3328
|
-
this.video.volume = originalVolume;
|
|
3333
|
+
const restoredMuted = this.ima.getOriginalMutedState();
|
|
3334
|
+
const restoredVolume = this.ima.getOriginalVolume();
|
|
3329
3335
|
console.log(
|
|
3330
|
-
`[DEBUG-AUDIO] \u{1F50A}
|
|
3336
|
+
`[DEBUG-AUDIO] \u{1F50A} Audio restored by IMA | muted=${restoredMuted}, volume=${restoredVolume}`
|
|
3331
3337
|
);
|
|
3338
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=visible, Ad=hidden, Placeholder=no");
|
|
3339
|
+
if (this.video.muted !== restoredMuted) {
|
|
3340
|
+
this.video.muted = restoredMuted;
|
|
3341
|
+
}
|
|
3342
|
+
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
3343
|
+
this.video.volume = restoredVolume;
|
|
3344
|
+
}
|
|
3332
3345
|
if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {
|
|
3333
3346
|
console.log("[DEBUG-FLOW] \u25B6\uFE0F Resuming main video playback");
|
|
3334
3347
|
(_a = this.video.play()) == null ? void 0 : _a.catch((error) => {
|
|
@@ -3337,20 +3350,20 @@ var StormcloudVideoPlayer = class {
|
|
|
3337
3350
|
}
|
|
3338
3351
|
}
|
|
3339
3352
|
handleAdFailure() {
|
|
3353
|
+
console.log("[DEBUG-POD] \u274C handleAdFailure - skipping to next ad or ending break");
|
|
3340
3354
|
const remaining = this.getRemainingAdMs();
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
return;
|
|
3355
|
+
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
3356
|
+
const nextPreloaded = this.findNextPreloadedAd();
|
|
3357
|
+
if (nextPreloaded) {
|
|
3358
|
+
this.currentAdIndex++;
|
|
3359
|
+
console.log(`[DEBUG-POD] \u27A1\uFE0F Trying next ad after failure (${this.currentAdIndex}/${this.totalAdsInBreak})`);
|
|
3360
|
+
this.playSingleAd(nextPreloaded).catch(() => {
|
|
3361
|
+
this.handleAdPodComplete();
|
|
3362
|
+
});
|
|
3363
|
+
return;
|
|
3364
|
+
}
|
|
3352
3365
|
}
|
|
3353
|
-
console.log("[DEBUG-POD] \u23F9\uFE0F
|
|
3366
|
+
console.log("[DEBUG-POD] \u23F9\uFE0F Ending ad break after failure");
|
|
3354
3367
|
this.handleAdPodComplete();
|
|
3355
3368
|
}
|
|
3356
3369
|
startAdRequestWatchdog(token) {
|
|
@@ -3423,12 +3436,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3423
3436
|
}
|
|
3424
3437
|
return [b.vastTagUrl];
|
|
3425
3438
|
}
|
|
3426
|
-
logQueuedAdUrls(urls) {
|
|
3427
|
-
if (!this.config.debugAdTiming) {
|
|
3428
|
-
return;
|
|
3429
|
-
}
|
|
3430
|
-
console.log("[StormcloudVideoPlayer] ALL ad URLs queued:", urls);
|
|
3431
|
-
}
|
|
3432
3439
|
logAdState(event, extra = {}) {
|
|
3433
3440
|
if (!this.config.debugAdTiming) {
|
|
3434
3441
|
return;
|
|
@@ -3443,22 +3450,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3443
3450
|
...extra
|
|
3444
3451
|
});
|
|
3445
3452
|
}
|
|
3446
|
-
enforceAdHoldState() {
|
|
3447
|
-
this.video.dataset.stormcloudAdPlaying = "true";
|
|
3448
|
-
this.video.muted = true;
|
|
3449
|
-
this.video.volume = 0;
|
|
3450
|
-
console.log("[DEBUG-LAYER] \u{1F512} Enforced ad hold state (main video muted)");
|
|
3451
|
-
if (typeof this.ima.showPlaceholder === "function") {
|
|
3452
|
-
this.ima.showPlaceholder();
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
releaseAdHoldState() {
|
|
3456
|
-
delete this.video.dataset.stormcloudAdPlaying;
|
|
3457
|
-
console.log("[DEBUG-LAYER] \u{1F513} Released ad hold state");
|
|
3458
|
-
if (typeof this.ima.hidePlaceholder === "function") {
|
|
3459
|
-
this.ima.hidePlaceholder();
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
3453
|
async fetchAndParseVastXml(vastTagUrl) {
|
|
3463
3454
|
try {
|
|
3464
3455
|
const response = await fetch(vastTagUrl, { mode: "cors" });
|
|
@@ -3823,7 +3814,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3823
3814
|
}
|
|
3824
3815
|
(_a = this.hls) == null ? void 0 : _a.destroy();
|
|
3825
3816
|
(_b = this.ima) == null ? void 0 : _b.destroy();
|
|
3826
|
-
this.releaseAdHoldState();
|
|
3827
3817
|
this.preloadingAdUrls.clear();
|
|
3828
3818
|
this.vastToMediaUrlMap.clear();
|
|
3829
3819
|
this.preloadedMediaUrls.clear();
|