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