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
package/lib/players/index.cjs
CHANGED
|
@@ -670,19 +670,10 @@ function createImaController(video, options) {
|
|
|
670
670
|
adsManager.addEventListener(
|
|
671
671
|
AdEvent.CONTENT_PAUSE_REQUESTED,
|
|
672
672
|
() => {
|
|
673
|
-
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad
|
|
673
|
+
console.log("[DEBUG-FLOW] \u{1F3AF} CONTENT_PAUSE_REQUESTED - Ad request accepted");
|
|
674
674
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
675
675
|
video.pause();
|
|
676
676
|
}
|
|
677
|
-
hideContentVideo();
|
|
678
|
-
if (adContainerEl) {
|
|
679
|
-
adContainerEl.style.pointerEvents = "auto";
|
|
680
|
-
adContainerEl.style.display = "flex";
|
|
681
|
-
adContainerEl.style.backgroundColor = "#000";
|
|
682
|
-
adContainerEl.offsetHeight;
|
|
683
|
-
adContainerEl.style.opacity = "1";
|
|
684
|
-
console.log("[DEBUG-LAYER] \u{1F7E1} Ad container VISIBLE");
|
|
685
|
-
}
|
|
686
677
|
adPlaying = true;
|
|
687
678
|
setAdPlayingFlag(true);
|
|
688
679
|
emit("content_pause");
|
|
@@ -2515,7 +2506,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2515
2506
|
this.clearAdRequestWatchdog();
|
|
2516
2507
|
this.activeAdRequestToken = null;
|
|
2517
2508
|
this.showAds = true;
|
|
2518
|
-
|
|
2509
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=hidden, Ad=visible, Placeholder=no");
|
|
2519
2510
|
});
|
|
2520
2511
|
this.ima.on("content_resume", () => {
|
|
2521
2512
|
console.log(`[DEBUG-POD] \u23F8\uFE0F content_resume | ad ${this.currentAdIndex}/${this.totalAdsInBreak}, queue=${this.adPodQueue.length}, remaining=${this.getRemainingAdMs()}ms`);
|
|
@@ -2695,6 +2686,12 @@ var StormcloudVideoPlayer = class {
|
|
|
2695
2686
|
});
|
|
2696
2687
|
}
|
|
2697
2688
|
if (marker.type === "start") {
|
|
2689
|
+
if (this.inAdBreak) {
|
|
2690
|
+
console.log(
|
|
2691
|
+
`[DEBUG-POD] \u26A0\uFE0F SCTE-35 start marker ignored - already in ad break (currentTime: ${this.video.currentTime})`
|
|
2692
|
+
);
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2698
2695
|
this.inAdBreak = true;
|
|
2699
2696
|
const durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
2700
2697
|
this.expectedAdBreakDurationMs = durationMs;
|
|
@@ -2761,6 +2758,9 @@ var StormcloudVideoPlayer = class {
|
|
|
2761
2758
|
return;
|
|
2762
2759
|
}
|
|
2763
2760
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
2761
|
+
console.log(
|
|
2762
|
+
`[DEBUG-POD] \u{1F4CA} SCTE-35 progress marker (currentTime: ${this.video.currentTime})`
|
|
2763
|
+
);
|
|
2764
2764
|
if (marker.durationSeconds != null) {
|
|
2765
2765
|
this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
|
|
2766
2766
|
}
|
|
@@ -2772,7 +2772,8 @@ var StormcloudVideoPlayer = class {
|
|
|
2772
2772
|
);
|
|
2773
2773
|
this.scheduleAdStopCountdown(remainingMs);
|
|
2774
2774
|
}
|
|
2775
|
-
if (!this.ima.isAdPlaying()) {
|
|
2775
|
+
if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null) {
|
|
2776
|
+
console.log("[DEBUG-POD] \u{1F4CA} Progress marker: no ad playing, attempting to start");
|
|
2776
2777
|
const scheduled = this.findCurrentOrNextBreak(
|
|
2777
2778
|
this.video.currentTime * 1e3
|
|
2778
2779
|
);
|
|
@@ -2781,25 +2782,31 @@ var StormcloudVideoPlayer = class {
|
|
|
2781
2782
|
const first = tags[0];
|
|
2782
2783
|
const rest = tags.slice(1);
|
|
2783
2784
|
this.adPodQueue = rest;
|
|
2784
|
-
if (!this.showAds) {
|
|
2785
|
-
this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
|
|
2786
|
-
}
|
|
2787
2785
|
this.playSingleAd(first).catch(() => {
|
|
2788
2786
|
});
|
|
2789
2787
|
}
|
|
2788
|
+
} else {
|
|
2789
|
+
console.log(
|
|
2790
|
+
`[DEBUG-POD] \u{1F4CA} Progress marker: ad playing or request active (playing=${this.ima.isAdPlaying()}, token=${this.activeAdRequestToken})`
|
|
2791
|
+
);
|
|
2790
2792
|
}
|
|
2791
2793
|
return;
|
|
2792
2794
|
}
|
|
2793
2795
|
if (marker.type === "end") {
|
|
2796
|
+
console.log(
|
|
2797
|
+
`[DEBUG-POD] \u{1F3C1} SCTE-35 end marker received (currentTime: ${this.video.currentTime})`
|
|
2798
|
+
);
|
|
2794
2799
|
this.inAdBreak = false;
|
|
2795
2800
|
this.expectedAdBreakDurationMs = void 0;
|
|
2796
2801
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
2797
2802
|
this.clearAdStartTimer();
|
|
2798
2803
|
this.clearAdStopTimer();
|
|
2799
2804
|
if (this.ima.isAdPlaying()) {
|
|
2805
|
+
console.log("[DEBUG-POD] \u{1F6D1} Stopping ad due to SCTE-35 end marker");
|
|
2800
2806
|
this.ima.stop().catch(() => {
|
|
2801
2807
|
});
|
|
2802
2808
|
}
|
|
2809
|
+
this.handleAdPodComplete();
|
|
2803
2810
|
return;
|
|
2804
2811
|
}
|
|
2805
2812
|
}
|
|
@@ -3130,10 +3137,12 @@ var StormcloudVideoPlayer = class {
|
|
|
3130
3137
|
this.vastToMediaUrlMap.clear();
|
|
3131
3138
|
this.preloadedMediaUrls.clear();
|
|
3132
3139
|
this.preloadingMediaUrls.clear();
|
|
3140
|
+
const currentMuted = this.video.muted;
|
|
3141
|
+
const currentVolume = this.video.volume;
|
|
3133
3142
|
console.log(
|
|
3134
|
-
`[DEBUG-AUDIO] \u{1F4BE} Capturing
|
|
3143
|
+
`[DEBUG-AUDIO] \u{1F4BE} Capturing ORIGINAL state (once) | muted=${currentMuted}, volume=${currentVolume}`
|
|
3135
3144
|
);
|
|
3136
|
-
this.ima.updateOriginalMutedState(
|
|
3145
|
+
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
3137
3146
|
this.inAdBreak = true;
|
|
3138
3147
|
this.currentAdIndex = 0;
|
|
3139
3148
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
@@ -3347,7 +3356,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3347
3356
|
this.clearAdRequestWatchdog();
|
|
3348
3357
|
this.clearAdFailsafeTimer();
|
|
3349
3358
|
this.activeAdRequestToken = null;
|
|
3350
|
-
this.releaseAdHoldState();
|
|
3351
3359
|
this.preloadingAdUrls.clear();
|
|
3352
3360
|
this.vastToMediaUrlMap.clear();
|
|
3353
3361
|
this.preloadedMediaUrls.clear();
|
|
@@ -3364,13 +3372,18 @@ var StormcloudVideoPlayer = class {
|
|
|
3364
3372
|
this.totalAdsInBreak = 0;
|
|
3365
3373
|
this.ima.stop().catch(() => {
|
|
3366
3374
|
});
|
|
3367
|
-
const
|
|
3368
|
-
const
|
|
3369
|
-
this.video.muted = originalMutedState;
|
|
3370
|
-
this.video.volume = originalVolume;
|
|
3375
|
+
const restoredMuted = this.ima.getOriginalMutedState();
|
|
3376
|
+
const restoredVolume = this.ima.getOriginalVolume();
|
|
3371
3377
|
console.log(
|
|
3372
|
-
`[DEBUG-AUDIO] \u{1F50A}
|
|
3378
|
+
`[DEBUG-AUDIO] \u{1F50A} Audio restored by IMA | muted=${restoredMuted}, volume=${restoredVolume}`
|
|
3373
3379
|
);
|
|
3380
|
+
console.log("[DEBUG-LAYER] \u{1F3AC} Layers: Main=visible, Ad=hidden, Placeholder=no");
|
|
3381
|
+
if (this.video.muted !== restoredMuted) {
|
|
3382
|
+
this.video.muted = restoredMuted;
|
|
3383
|
+
}
|
|
3384
|
+
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
3385
|
+
this.video.volume = restoredVolume;
|
|
3386
|
+
}
|
|
3374
3387
|
if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {
|
|
3375
3388
|
console.log("[DEBUG-FLOW] \u25B6\uFE0F Resuming main video playback");
|
|
3376
3389
|
(_a = this.video.play()) == null ? void 0 : _a.catch((error) => {
|
|
@@ -3379,20 +3392,20 @@ var StormcloudVideoPlayer = class {
|
|
|
3379
3392
|
}
|
|
3380
3393
|
}
|
|
3381
3394
|
handleAdFailure() {
|
|
3395
|
+
console.log("[DEBUG-POD] \u274C handleAdFailure - skipping to next ad or ending break");
|
|
3382
3396
|
const remaining = this.getRemainingAdMs();
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
return;
|
|
3397
|
+
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
3398
|
+
const nextPreloaded = this.findNextPreloadedAd();
|
|
3399
|
+
if (nextPreloaded) {
|
|
3400
|
+
this.currentAdIndex++;
|
|
3401
|
+
console.log(`[DEBUG-POD] \u27A1\uFE0F Trying next ad after failure (${this.currentAdIndex}/${this.totalAdsInBreak})`);
|
|
3402
|
+
this.playSingleAd(nextPreloaded).catch(() => {
|
|
3403
|
+
this.handleAdPodComplete();
|
|
3404
|
+
});
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3394
3407
|
}
|
|
3395
|
-
console.log("[DEBUG-POD] \u23F9\uFE0F
|
|
3408
|
+
console.log("[DEBUG-POD] \u23F9\uFE0F Ending ad break after failure");
|
|
3396
3409
|
this.handleAdPodComplete();
|
|
3397
3410
|
}
|
|
3398
3411
|
startAdRequestWatchdog(token) {
|
|
@@ -3465,12 +3478,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3465
3478
|
}
|
|
3466
3479
|
return [b.vastTagUrl];
|
|
3467
3480
|
}
|
|
3468
|
-
logQueuedAdUrls(urls) {
|
|
3469
|
-
if (!this.config.debugAdTiming) {
|
|
3470
|
-
return;
|
|
3471
|
-
}
|
|
3472
|
-
console.log("[StormcloudVideoPlayer] ALL ad URLs queued:", urls);
|
|
3473
|
-
}
|
|
3474
3481
|
logAdState(event, extra = {}) {
|
|
3475
3482
|
if (!this.config.debugAdTiming) {
|
|
3476
3483
|
return;
|
|
@@ -3485,22 +3492,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3485
3492
|
...extra
|
|
3486
3493
|
});
|
|
3487
3494
|
}
|
|
3488
|
-
enforceAdHoldState() {
|
|
3489
|
-
this.video.dataset.stormcloudAdPlaying = "true";
|
|
3490
|
-
this.video.muted = true;
|
|
3491
|
-
this.video.volume = 0;
|
|
3492
|
-
console.log("[DEBUG-LAYER] \u{1F512} Enforced ad hold state (main video muted)");
|
|
3493
|
-
if (typeof this.ima.showPlaceholder === "function") {
|
|
3494
|
-
this.ima.showPlaceholder();
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
releaseAdHoldState() {
|
|
3498
|
-
delete this.video.dataset.stormcloudAdPlaying;
|
|
3499
|
-
console.log("[DEBUG-LAYER] \u{1F513} Released ad hold state");
|
|
3500
|
-
if (typeof this.ima.hidePlaceholder === "function") {
|
|
3501
|
-
this.ima.hidePlaceholder();
|
|
3502
|
-
}
|
|
3503
|
-
}
|
|
3504
3495
|
async fetchAndParseVastXml(vastTagUrl) {
|
|
3505
3496
|
try {
|
|
3506
3497
|
const response = await fetch(vastTagUrl, { mode: "cors" });
|
|
@@ -3865,7 +3856,6 @@ var StormcloudVideoPlayer = class {
|
|
|
3865
3856
|
}
|
|
3866
3857
|
(_a = this.hls) == null ? void 0 : _a.destroy();
|
|
3867
3858
|
(_b = this.ima) == null ? void 0 : _b.destroy();
|
|
3868
|
-
this.releaseAdHoldState();
|
|
3869
3859
|
this.preloadingAdUrls.clear();
|
|
3870
3860
|
this.vastToMediaUrlMap.clear();
|
|
3871
3861
|
this.preloadedMediaUrls.clear();
|