stormcloud-video-player 0.2.22 → 0.2.24
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 +70 -20
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +70 -20
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +70 -20
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +70 -20
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +70 -20
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +12 -0
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +18 -2
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +70 -20
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -439,9 +439,13 @@ function createImaController(video, options) {
|
|
|
439
439
|
adsLoader.addEventListener(
|
|
440
440
|
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
441
441
|
(evt) => {
|
|
442
|
-
console.log(
|
|
442
|
+
console.log(
|
|
443
|
+
"[IMA] Ads manager loaded - enabling preloading for continuous playback"
|
|
444
|
+
);
|
|
443
445
|
try {
|
|
444
|
-
|
|
446
|
+
const adsRenderingSettings = new google.ima.AdsRenderingSettings();
|
|
447
|
+
adsRenderingSettings.enablePreloading = true;
|
|
448
|
+
adsManager = evt.getAdsManager(video, adsRenderingSettings);
|
|
445
449
|
const AdEvent = google.ima.AdEvent.Type;
|
|
446
450
|
const AdErrorEvent = google.ima.AdErrorEvent.Type;
|
|
447
451
|
adsManager.addEventListener(
|
|
@@ -538,6 +542,18 @@ function createImaController(video, options) {
|
|
|
538
542
|
adPlaying = false;
|
|
539
543
|
setAdPlayingFlag(false);
|
|
540
544
|
emit("content_resume");
|
|
545
|
+
setTimeout(() => {
|
|
546
|
+
const stillInPod = video.dataset.stormcloudAdPlaying === "true";
|
|
547
|
+
if (stillInPod) {
|
|
548
|
+
console.log(
|
|
549
|
+
"[IMA] Still in ad pod - keeping ad container visible (black screen)"
|
|
550
|
+
);
|
|
551
|
+
if (adContainerEl) {
|
|
552
|
+
adContainerEl.style.display = "flex";
|
|
553
|
+
adContainerEl.style.pointerEvents = "auto";
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}, 50);
|
|
541
557
|
}
|
|
542
558
|
);
|
|
543
559
|
adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
|
|
@@ -1087,6 +1103,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1087
1103
|
adPlaying = false;
|
|
1088
1104
|
setAdPlayingFlag(false);
|
|
1089
1105
|
emit("content_resume");
|
|
1106
|
+
setTimeout(() => {
|
|
1107
|
+
const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
|
|
1108
|
+
if (stillInPod) {
|
|
1109
|
+
console.log(
|
|
1110
|
+
"[HlsAdPlayer] Still in ad pod - keeping ad container visible (black screen)"
|
|
1111
|
+
);
|
|
1112
|
+
if (adContainerEl) {
|
|
1113
|
+
adContainerEl.style.display = "flex";
|
|
1114
|
+
adContainerEl.style.pointerEvents = "auto";
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}, 50);
|
|
1090
1118
|
}
|
|
1091
1119
|
function handleAdError() {
|
|
1092
1120
|
console.log("[HlsAdPlayer] Handling ad error");
|
|
@@ -2145,9 +2173,12 @@ var StormcloudVideoPlayer = class {
|
|
|
2145
2173
|
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
2146
2174
|
const next = this.adPodQueue.shift();
|
|
2147
2175
|
this.currentAdIndex++;
|
|
2176
|
+
this.video.dataset.stormcloudAdPlaying = "true";
|
|
2177
|
+
this.video.muted = true;
|
|
2178
|
+
this.video.volume = 0;
|
|
2148
2179
|
if (this.config.debugAdTiming) {
|
|
2149
2180
|
console.log(
|
|
2150
|
-
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) -
|
|
2181
|
+
`[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - IMMEDIATELY starting next ad`
|
|
2151
2182
|
);
|
|
2152
2183
|
}
|
|
2153
2184
|
this.playSingleAd(next).catch(() => {
|
|
@@ -2732,25 +2763,21 @@ var StormcloudVideoPlayer = class {
|
|
|
2732
2763
|
this.video.currentTime * 1e3
|
|
2733
2764
|
);
|
|
2734
2765
|
const tags = this.selectVastTagsForBreak(scheduled);
|
|
2735
|
-
let
|
|
2766
|
+
let vastTagUrls = [];
|
|
2736
2767
|
if (this.apiVastTagUrl) {
|
|
2737
|
-
|
|
2738
|
-
this.adPodQueue = [];
|
|
2739
|
-
this.currentAdIndex = 0;
|
|
2740
|
-
this.totalAdsInBreak = 1;
|
|
2768
|
+
vastTagUrls = [this.apiVastTagUrl];
|
|
2741
2769
|
if (this.config.debugAdTiming) {
|
|
2742
|
-
console.log(
|
|
2770
|
+
console.log(
|
|
2771
|
+
"[StormcloudVideoPlayer] Using VAST endpoint:",
|
|
2772
|
+
this.apiVastTagUrl
|
|
2773
|
+
);
|
|
2743
2774
|
}
|
|
2744
2775
|
} else if (tags && tags.length > 0) {
|
|
2745
|
-
|
|
2746
|
-
const rest = tags.slice(1);
|
|
2747
|
-
this.adPodQueue = rest;
|
|
2748
|
-
this.currentAdIndex = 0;
|
|
2749
|
-
this.totalAdsInBreak = tags.length;
|
|
2776
|
+
vastTagUrls = tags;
|
|
2750
2777
|
if (this.config.debugAdTiming) {
|
|
2751
2778
|
console.log(
|
|
2752
|
-
"[StormcloudVideoPlayer] Using scheduled VAST
|
|
2753
|
-
|
|
2779
|
+
"[StormcloudVideoPlayer] Using scheduled VAST tags (count: " + tags.length + "):",
|
|
2780
|
+
tags
|
|
2754
2781
|
);
|
|
2755
2782
|
}
|
|
2756
2783
|
} else {
|
|
@@ -2759,16 +2786,23 @@ var StormcloudVideoPlayer = class {
|
|
|
2759
2786
|
}
|
|
2760
2787
|
return;
|
|
2761
2788
|
}
|
|
2762
|
-
if (
|
|
2789
|
+
if (vastTagUrls.length > 0) {
|
|
2763
2790
|
this.inAdBreak = true;
|
|
2764
2791
|
this.showAds = true;
|
|
2765
|
-
this.currentAdIndex
|
|
2792
|
+
this.currentAdIndex = 0;
|
|
2793
|
+
this.totalAdsInBreak = vastTagUrls.length;
|
|
2794
|
+
this.adPodQueue = [...vastTagUrls];
|
|
2795
|
+
if (this.config.debugAdTiming) {
|
|
2796
|
+
console.log(
|
|
2797
|
+
`[StormcloudVideoPlayer] Starting ad pod with ${vastTagUrls.length} ads - will play continuously`
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2766
2800
|
try {
|
|
2767
|
-
await this.
|
|
2801
|
+
await this.playAdPod();
|
|
2768
2802
|
} catch (error) {
|
|
2769
2803
|
if (this.config.debugAdTiming) {
|
|
2770
2804
|
console.error(
|
|
2771
|
-
"[StormcloudVideoPlayer] Ad playback failed
|
|
2805
|
+
"[StormcloudVideoPlayer] Ad pod playback failed:",
|
|
2772
2806
|
error
|
|
2773
2807
|
);
|
|
2774
2808
|
}
|
|
@@ -2781,6 +2815,22 @@ var StormcloudVideoPlayer = class {
|
|
|
2781
2815
|
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
2782
2816
|
}
|
|
2783
2817
|
}
|
|
2818
|
+
async playAdPod() {
|
|
2819
|
+
if (this.adPodQueue.length === 0) {
|
|
2820
|
+
if (this.config.debugAdTiming) {
|
|
2821
|
+
console.log("[StormcloudVideoPlayer] No ads in pod to play");
|
|
2822
|
+
}
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
const firstAd = this.adPodQueue.shift();
|
|
2826
|
+
this.currentAdIndex++;
|
|
2827
|
+
if (this.config.debugAdTiming) {
|
|
2828
|
+
console.log(
|
|
2829
|
+
`[StormcloudVideoPlayer] Playing ad ${this.currentAdIndex}/${this.totalAdsInBreak}`
|
|
2830
|
+
);
|
|
2831
|
+
}
|
|
2832
|
+
await this.playSingleAd(firstAd);
|
|
2833
|
+
}
|
|
2784
2834
|
findCurrentOrNextBreak(nowMs) {
|
|
2785
2835
|
var _a;
|
|
2786
2836
|
const schedule = [];
|