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
|
@@ -80,10 +80,7 @@ declare class StormcloudVideoPlayer {
|
|
|
80
80
|
private startAdFailsafeTimer;
|
|
81
81
|
private clearAdFailsafeTimer;
|
|
82
82
|
private selectVastTagsForBreak;
|
|
83
|
-
private logQueuedAdUrls;
|
|
84
83
|
private logAdState;
|
|
85
|
-
private enforceAdHoldState;
|
|
86
|
-
private releaseAdHoldState;
|
|
87
84
|
private fetchAndParseVastXml;
|
|
88
85
|
private extractMediaUrlsFromVast;
|
|
89
86
|
private preloadMediaFile;
|
|
@@ -631,19 +631,10 @@ function createImaController(video, options) {
|
|
|
631
631
|
adsManager.addEventListener(
|
|
632
632
|
AdEvent.CONTENT_PAUSE_REQUESTED,
|
|
633
633
|
() => {
|
|
634
|
-
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad
|
|
634
|
+
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad request accepted");
|
|
635
635
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
636
636
|
video.pause();
|
|
637
637
|
}
|
|
638
|
-
hideContentVideo();
|
|
639
|
-
if (adContainerEl) {
|
|
640
|
-
adContainerEl.style.pointerEvents = "auto";
|
|
641
|
-
adContainerEl.style.display = "flex";
|
|
642
|
-
adContainerEl.style.backgroundColor = "#000";
|
|
643
|
-
adContainerEl.offsetHeight;
|
|
644
|
-
adContainerEl.style.opacity = "1";
|
|
645
|
-
console.log("[DEBUG-LAYER] \u{1F7E1} Ad container VISIBLE");
|
|
646
|
-
}
|
|
647
638
|
adPlaying = true;
|
|
648
639
|
setAdPlayingFlag(true);
|
|
649
640
|
emit("content_pause");
|
|
@@ -2476,7 +2467,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2476
2467
|
this.clearAdRequestWatchdog();
|
|
2477
2468
|
this.activeAdRequestToken = null;
|
|
2478
2469
|
this.showAds = true;
|
|
2479
|
-
|
|
2470
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=hidden, Ad=visible, Placeholder=no");
|
|
2480
2471
|
});
|
|
2481
2472
|
this.ima.on("content_resume", () => {
|
|
2482
2473
|
console.log(`[DEBUG-POD] \u23F8\uFE0F content_resume | ad ${this.currentAdIndex}/${this.totalAdsInBreak}, queue=${this.adPodQueue.length}, remaining=${this.getRemainingAdMs()}ms`);
|
|
@@ -2656,6 +2647,12 @@ var StormcloudVideoPlayer = class {
|
|
|
2656
2647
|
});
|
|
2657
2648
|
}
|
|
2658
2649
|
if (marker.type === "start") {
|
|
2650
|
+
if (this.inAdBreak) {
|
|
2651
|
+
console.log(
|
|
2652
|
+
`[DEBUG-POD] \u26A0\uFE0F SCTE-35 start marker ignored - already in ad break (currentTime: ${this.video.currentTime})`
|
|
2653
|
+
);
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2659
2656
|
this.inAdBreak = true;
|
|
2660
2657
|
const durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
2661
2658
|
this.expectedAdBreakDurationMs = durationMs;
|
|
@@ -2722,6 +2719,9 @@ var StormcloudVideoPlayer = class {
|
|
|
2722
2719
|
return;
|
|
2723
2720
|
}
|
|
2724
2721
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
2722
|
+
console.log(
|
|
2723
|
+
`[DEBUG-POD] \u{1F4CA} SCTE-35 progress marker (currentTime: ${this.video.currentTime})`
|
|
2724
|
+
);
|
|
2725
2725
|
if (marker.durationSeconds != null) {
|
|
2726
2726
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
2727
2727
|
}
|
|
@@ -2733,7 +2733,8 @@ var StormcloudVideoPlayer = class {
|
|
|
2733
2733
|
);
|
|
2734
2734
|
this.scheduleAdStopCountdown(remainingMs);
|
|
2735
2735
|
}
|
|
2736
|
-
if (!this.ima.isAdPlaying()) {
|
|
2736
|
+
if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null) {
|
|
2737
|
+
console.log("[DEBUG-POD] \u{1F4CA} Progress marker: no ad playing, attempting to start");
|
|
2737
2738
|
const scheduled = this.findCurrentOrNextBreak(
|
|
2738
2739
|
this.video.currentTime * 1e3
|
|
2739
2740
|
);
|
|
@@ -2742,25 +2743,31 @@ var StormcloudVideoPlayer = class {
|
|
|
2742
2743
|
const first = tags[0];
|
|
2743
2744
|
const rest = tags.slice(1);
|
|
2744
2745
|
this.adPodQueue = rest;
|
|
2745
|
-
if (!this.showAds) {
|
|
2746
|
-
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
2747
|
-
}
|
|
2748
2746
|
this.playSingleAd(first).catch(() => {
|
|
2749
2747
|
});
|
|
2750
2748
|
}
|
|
2749
|
+
} else {
|
|
2750
|
+
console.log(
|
|
2751
|
+
`[DEBUG-POD] \u{1F4CA} Progress marker: ad playing or request active (playing=${this.ima.isAdPlaying()}, token=${this.activeAdRequestToken})`
|
|
2752
|
+
);
|
|
2751
2753
|
}
|
|
2752
2754
|
return;
|
|
2753
2755
|
}
|
|
2754
2756
|
if (marker.type === "end") {
|
|
2757
|
+
console.log(
|
|
2758
|
+
`[DEBUG-POD] \u{1F3C1} SCTE-35 end marker received (currentTime: ${this.video.currentTime})`
|
|
2759
|
+
);
|
|
2755
2760
|
this.inAdBreak = false;
|
|
2756
2761
|
this.expectedAdBreakDurationMs = void 0;
|
|
2757
2762
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
2758
2763
|
this.clearAdStartTimer();
|
|
2759
2764
|
this.clearAdStopTimer();
|
|
2760
2765
|
if (this.ima.isAdPlaying()) {
|
|
2766
|
+
console.log("[DEBUG-POD] \u{1F6D1} Stopping ad due to SCTE-35 end marker");
|
|
2761
2767
|
this.ima.stop().catch(() => {
|
|
2762
2768
|
});
|
|
2763
2769
|
}
|
|
2770
|
+
this.handleAdPodComplete();
|
|
2764
2771
|
return;
|
|
2765
2772
|
}
|
|
2766
2773
|
}
|
|
@@ -3091,10 +3098,12 @@ var StormcloudVideoPlayer = class {
|
|
|
3091
3098
|
this.vastToMediaUrlMap.clear();
|
|
3092
3099
|
this.preloadedMediaUrls.clear();
|
|
3093
3100
|
this.preloadingMediaUrls.clear();
|
|
3101
|
+
const currentMuted = this.video.muted;
|
|
3102
|
+
const currentVolume = this.video.volume;
|
|
3094
3103
|
console.log(
|
|
3095
|
-
`[DEBUG-AUDIO] \u{1F4BE} Capturing
|
|
3104
|
+
`[DEBUG-AUDIO] \u{1F4BE} Capturing ORIGINAL state (once) | muted=${currentMuted}, volume=${currentVolume}`
|
|
3096
3105
|
);
|
|
3097
|
-
this.ima.updateOriginalMutedState(
|
|
3106
|
+
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
3098
3107
|
this.inAdBreak = true;
|
|
3099
3108
|
this.currentAdIndex = 0;
|
|
3100
3109
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
@@ -3308,7 +3317,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3308
3317
|
this.clearAdRequestWatchdog();
|
|
3309
3318
|
this.clearAdFailsafeTimer();
|
|
3310
3319
|
this.activeAdRequestToken = null;
|
|
3311
|
-
this.releaseAdHoldState();
|
|
3312
3320
|
this.preloadingAdUrls.clear();
|
|
3313
3321
|
this.vastToMediaUrlMap.clear();
|
|
3314
3322
|
this.preloadedMediaUrls.clear();
|
|
@@ -3325,13 +3333,18 @@ var StormcloudVideoPlayer = class {
|
|
|
3325
3333
|
this.totalAdsInBreak = 0;
|
|
3326
3334
|
this.ima.stop().catch(() => {
|
|
3327
3335
|
});
|
|
3328
|
-
const
|
|
3329
|
-
const
|
|
3330
|
-
this.video.muted = originalMutedState;
|
|
3331
|
-
this.video.volume = originalVolume;
|
|
3336
|
+
const restoredMuted = this.ima.getOriginalMutedState();
|
|
3337
|
+
const restoredVolume = this.ima.getOriginalVolume();
|
|
3332
3338
|
console.log(
|
|
3333
|
-
`[DEBUG-AUDIO] \u{1F50A}
|
|
3339
|
+
`[DEBUG-AUDIO] \u{1F50A} Audio restored by IMA | muted=${restoredMuted}, volume=${restoredVolume}`
|
|
3334
3340
|
);
|
|
3341
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=visible, Ad=hidden, Placeholder=no");
|
|
3342
|
+
if (this.video.muted !== restoredMuted) {
|
|
3343
|
+
this.video.muted = restoredMuted;
|
|
3344
|
+
}
|
|
3345
|
+
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
3346
|
+
this.video.volume = restoredVolume;
|
|
3347
|
+
}
|
|
3335
3348
|
if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {
|
|
3336
3349
|
console.log("[DEBUG-FLOW] \u25B6\uFE0F Resuming main video playback");
|
|
3337
3350
|
(_a = this.video.play()) == null ? void 0 : _a.catch((error) => {
|
|
@@ -3340,20 +3353,20 @@ var StormcloudVideoPlayer = class {
|
|
|
3340
3353
|
}
|
|
3341
3354
|
}
|
|
3342
3355
|
handleAdFailure() {
|
|
3356
|
+
console.log("[DEBUG-POD] \u274C handleAdFailure - skipping to next ad or ending break");
|
|
3343
3357
|
const remaining = this.getRemainingAdMs();
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
return;
|
|
3358
|
+
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
3359
|
+
const nextPreloaded = this.findNextPreloadedAd();
|
|
3360
|
+
if (nextPreloaded) {
|
|
3361
|
+
this.currentAdIndex++;
|
|
3362
|
+
console.log(`[DEBUG-POD] \u27A1\uFE0F Trying next ad after failure (${this.currentAdIndex}/${this.totalAdsInBreak})`);
|
|
3363
|
+
this.playSingleAd(nextPreloaded).catch(() => {
|
|
3364
|
+
this.handleAdPodComplete();
|
|
3365
|
+
});
|
|
3366
|
+
return;
|
|
3367
|
+
}
|
|
3355
3368
|
}
|
|
3356
|
-
console.log("[DEBUG-POD] \u23F9\uFE0F
|
|
3369
|
+
console.log("[DEBUG-POD] \u23F9\uFE0F Ending ad break after failure");
|
|
3357
3370
|
this.handleAdPodComplete();
|
|
3358
3371
|
}
|
|
3359
3372
|
startAdRequestWatchdog(token) {
|
|
@@ -3426,12 +3439,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3426
3439
|
}
|
|
3427
3440
|
return [b.vastTagUrl];
|
|
3428
3441
|
}
|
|
3429
|
-
logQueuedAdUrls(urls) {
|
|
3430
|
-
if (!this.config.debugAdTiming) {
|
|
3431
|
-
return;
|
|
3432
|
-
}
|
|
3433
|
-
console.log("[StormcloudVideoPlayer] ALL ad URLs queued:", urls);
|
|
3434
|
-
}
|
|
3435
3442
|
logAdState(event, extra = {}) {
|
|
3436
3443
|
if (!this.config.debugAdTiming) {
|
|
3437
3444
|
return;
|
|
@@ -3446,22 +3453,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3446
3453
|
...extra
|
|
3447
3454
|
});
|
|
3448
3455
|
}
|
|
3449
|
-
enforceAdHoldState() {
|
|
3450
|
-
this.video.dataset.stormcloudAdPlaying = "true";
|
|
3451
|
-
this.video.muted = true;
|
|
3452
|
-
this.video.volume = 0;
|
|
3453
|
-
console.log("[DEBUG-LAYER] \u{1F512} Enforced ad hold state (main video muted)");
|
|
3454
|
-
if (typeof this.ima.showPlaceholder === "function") {
|
|
3455
|
-
this.ima.showPlaceholder();
|
|
3456
|
-
}
|
|
3457
|
-
}
|
|
3458
|
-
releaseAdHoldState() {
|
|
3459
|
-
delete this.video.dataset.stormcloudAdPlaying;
|
|
3460
|
-
console.log("[DEBUG-LAYER] \u{1F513} Released ad hold state");
|
|
3461
|
-
if (typeof this.ima.hidePlaceholder === "function") {
|
|
3462
|
-
this.ima.hidePlaceholder();
|
|
3463
|
-
}
|
|
3464
|
-
}
|
|
3465
3456
|
async fetchAndParseVastXml(vastTagUrl) {
|
|
3466
3457
|
try {
|
|
3467
3458
|
const response = await fetch(vastTagUrl, { mode: "cors" });
|
|
@@ -3826,7 +3817,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3826
3817
|
}
|
|
3827
3818
|
(_a = this.hls) == null ? void 0 : _a.destroy();
|
|
3828
3819
|
(_b = this.ima) == null ? void 0 : _b.destroy();
|
|
3829
|
-
this.releaseAdHoldState();
|
|
3830
3820
|
this.preloadingAdUrls.clear();
|
|
3831
3821
|
this.vastToMediaUrlMap.clear();
|
|
3832
3822
|
this.preloadedMediaUrls.clear();
|