stormcloud-video-player 0.2.28 → 0.2.29
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 +49 -30
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +49 -30
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +49 -30
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +49 -30
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +49 -30
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/ima.cjs +49 -30
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +49 -30
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -201,6 +201,7 @@ function getBrowserConfigOverrides() {
|
|
|
201
201
|
// src/sdk/ima.ts
|
|
202
202
|
function createImaController(video, options) {
|
|
203
203
|
let adPlaying = false;
|
|
204
|
+
let contentVideoHidden = false;
|
|
204
205
|
let originalMutedState = false;
|
|
205
206
|
let originalVolume = typeof video.volume === "number" && !Number.isNaN(video.volume) ? Math.max(0, Math.min(1, video.volume)) : 1;
|
|
206
207
|
const listeners = /* @__PURE__ */ new Map();
|
|
@@ -214,6 +215,26 @@ function createImaController(video, options) {
|
|
|
214
215
|
delete video.dataset.stormcloudAdPlaying;
|
|
215
216
|
}
|
|
216
217
|
}
|
|
218
|
+
function hideContentVideo() {
|
|
219
|
+
if (!contentVideoHidden) {
|
|
220
|
+
video.style.visibility = "hidden";
|
|
221
|
+
video.muted = true;
|
|
222
|
+
video.volume = 0;
|
|
223
|
+
contentVideoHidden = true;
|
|
224
|
+
console.log("[IMA] Content video hidden and muted");
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function showContentVideo() {
|
|
228
|
+
if (contentVideoHidden) {
|
|
229
|
+
video.style.visibility = "visible";
|
|
230
|
+
video.muted = originalMutedState;
|
|
231
|
+
video.volume = originalVolume;
|
|
232
|
+
contentVideoHidden = false;
|
|
233
|
+
console.log(
|
|
234
|
+
`[IMA] Content video restored (muted: ${originalMutedState}, volume: ${originalVolume})`
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
217
238
|
function createAdVideoElement() {
|
|
218
239
|
const adVideo = document.createElement("video");
|
|
219
240
|
adVideo.style.position = "absolute";
|
|
@@ -222,11 +243,20 @@ function createImaController(video, options) {
|
|
|
222
243
|
adVideo.style.width = "100%";
|
|
223
244
|
adVideo.style.height = "100%";
|
|
224
245
|
adVideo.style.objectFit = "contain";
|
|
225
|
-
adVideo.style.backgroundColor = "
|
|
246
|
+
adVideo.style.backgroundColor = "transparent";
|
|
226
247
|
adVideo.style.zIndex = "15";
|
|
227
248
|
adVideo.playsInline = true;
|
|
228
249
|
adVideo.muted = false;
|
|
229
250
|
adVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
251
|
+
adVideo.style.opacity = "0";
|
|
252
|
+
adVideo.addEventListener(
|
|
253
|
+
"canplay",
|
|
254
|
+
() => {
|
|
255
|
+
adVideo.style.opacity = "1";
|
|
256
|
+
console.log("[IMA] Ad video ready to play");
|
|
257
|
+
},
|
|
258
|
+
{ once: true }
|
|
259
|
+
);
|
|
230
260
|
console.log(
|
|
231
261
|
`[IMA] Created dedicated ad video element with volume: ${adVideo.volume}, muted: ${adVideo.muted}`
|
|
232
262
|
);
|
|
@@ -390,6 +420,9 @@ function createImaController(video, options) {
|
|
|
390
420
|
}
|
|
391
421
|
adsManager = void 0;
|
|
392
422
|
}
|
|
423
|
+
if (adVideoElement) {
|
|
424
|
+
adVideoElement.style.opacity = "0";
|
|
425
|
+
}
|
|
393
426
|
}
|
|
394
427
|
return {
|
|
395
428
|
initialize() {
|
|
@@ -540,11 +573,8 @@ function createImaController(video, options) {
|
|
|
540
573
|
console.error("[IMA] Ad error:", errorEvent.getError());
|
|
541
574
|
destroyAdsManager();
|
|
542
575
|
adPlaying = false;
|
|
543
|
-
|
|
576
|
+
showContentVideo();
|
|
544
577
|
setAdPlayingFlag(false);
|
|
545
|
-
console.log(
|
|
546
|
-
"[IMA] Restored main video visibility after ad error"
|
|
547
|
-
);
|
|
548
578
|
if (adContainerEl) {
|
|
549
579
|
adContainerEl.style.pointerEvents = "none";
|
|
550
580
|
adContainerEl.style.display = "none";
|
|
@@ -586,29 +616,24 @@ function createImaController(video, options) {
|
|
|
586
616
|
adsManager.addEventListener(
|
|
587
617
|
AdEvent.CONTENT_PAUSE_REQUESTED,
|
|
588
618
|
() => {
|
|
589
|
-
console.log(
|
|
590
|
-
"[IMA] Content pause requested - hiding main video, showing ad video"
|
|
591
|
-
);
|
|
619
|
+
console.log("[IMA] Content pause requested");
|
|
592
620
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
593
621
|
video.pause();
|
|
594
622
|
console.log("[IMA] Content video paused (VOD mode)");
|
|
595
623
|
} else {
|
|
596
624
|
console.log(
|
|
597
|
-
"[IMA] Content video continues
|
|
625
|
+
"[IMA] Content video continues in background (Live mode)"
|
|
598
626
|
);
|
|
599
627
|
}
|
|
600
|
-
video.style.visibility = "hidden";
|
|
601
628
|
adPlaying = true;
|
|
602
629
|
setAdPlayingFlag(true);
|
|
603
630
|
emit("content_pause");
|
|
604
631
|
}
|
|
605
632
|
);
|
|
606
633
|
adsManager.addEventListener(AdEvent.STARTED, () => {
|
|
607
|
-
console.log(
|
|
608
|
-
"[IMA] Ad started playing - showing dedicated ad video"
|
|
609
|
-
);
|
|
634
|
+
console.log("[IMA] Ad started - showing ad video");
|
|
610
635
|
setAdPlayingFlag(true);
|
|
611
|
-
|
|
636
|
+
hideContentVideo();
|
|
612
637
|
if (adVideoElement) {
|
|
613
638
|
adVideoElement.volume = originalMutedState ? 0 : originalVolume;
|
|
614
639
|
adVideoElement.muted = originalMutedState;
|
|
@@ -619,32 +644,28 @@ function createImaController(video, options) {
|
|
|
619
644
|
if (adContainerEl) {
|
|
620
645
|
adContainerEl.style.pointerEvents = "auto";
|
|
621
646
|
adContainerEl.style.display = "flex";
|
|
622
|
-
console.log(
|
|
623
|
-
"[IMA] Ad container visible with dedicated ad video"
|
|
624
|
-
);
|
|
647
|
+
console.log("[IMA] Ad container now visible");
|
|
625
648
|
}
|
|
626
649
|
});
|
|
627
650
|
adsManager.addEventListener(
|
|
628
651
|
AdEvent.CONTENT_RESUME_REQUESTED,
|
|
629
652
|
() => {
|
|
630
|
-
console.log(
|
|
631
|
-
"[IMA] Content resume requested - showing main video"
|
|
632
|
-
);
|
|
653
|
+
console.log("[IMA] Content resume requested");
|
|
633
654
|
adPlaying = false;
|
|
634
655
|
setAdPlayingFlag(false);
|
|
635
|
-
|
|
656
|
+
showContentVideo();
|
|
636
657
|
emit("content_resume");
|
|
637
658
|
setTimeout(() => {
|
|
638
659
|
const stillInPod = video.dataset.stormcloudAdPlaying === "true";
|
|
639
660
|
if (stillInPod) {
|
|
640
661
|
console.log(
|
|
641
|
-
"[IMA] Still in ad pod - keeping ad
|
|
662
|
+
"[IMA] Still in ad pod - keeping ad container visible"
|
|
642
663
|
);
|
|
643
664
|
if (adContainerEl) {
|
|
644
665
|
adContainerEl.style.display = "flex";
|
|
645
666
|
adContainerEl.style.pointerEvents = "auto";
|
|
646
667
|
}
|
|
647
|
-
|
|
668
|
+
hideContentVideo();
|
|
648
669
|
}
|
|
649
670
|
}, 50);
|
|
650
671
|
}
|
|
@@ -664,7 +685,7 @@ function createImaController(video, options) {
|
|
|
664
685
|
} catch (e) {
|
|
665
686
|
console.error("[IMA] Error setting up ads manager:", e);
|
|
666
687
|
adPlaying = false;
|
|
667
|
-
|
|
688
|
+
showContentVideo();
|
|
668
689
|
setAdPlayingFlag(false);
|
|
669
690
|
if (adContainerEl) {
|
|
670
691
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -695,11 +716,8 @@ function createImaController(video, options) {
|
|
|
695
716
|
(adErrorEvent) => {
|
|
696
717
|
console.error("[IMA] Ads loader error:", adErrorEvent.getError());
|
|
697
718
|
adPlaying = false;
|
|
698
|
-
|
|
719
|
+
showContentVideo();
|
|
699
720
|
setAdPlayingFlag(false);
|
|
700
|
-
console.log(
|
|
701
|
-
"[IMA] Restored main video visibility after loader error"
|
|
702
|
-
);
|
|
703
721
|
if (adContainerEl) {
|
|
704
722
|
adContainerEl.style.pointerEvents = "none";
|
|
705
723
|
adContainerEl.style.display = "none";
|
|
@@ -810,7 +828,7 @@ function createImaController(video, options) {
|
|
|
810
828
|
console.log("[IMA] Stopping ad playback");
|
|
811
829
|
adPlaying = false;
|
|
812
830
|
setAdPlayingFlag(false);
|
|
813
|
-
|
|
831
|
+
showContentVideo();
|
|
814
832
|
if (adContainerEl) {
|
|
815
833
|
adContainerEl.style.pointerEvents = "none";
|
|
816
834
|
adContainerEl.style.display = "none";
|
|
@@ -826,7 +844,7 @@ function createImaController(video, options) {
|
|
|
826
844
|
var _a;
|
|
827
845
|
destroyAdsManager();
|
|
828
846
|
adPlaying = false;
|
|
829
|
-
|
|
847
|
+
showContentVideo();
|
|
830
848
|
setAdPlayingFlag(false);
|
|
831
849
|
if (adContainerEl) {
|
|
832
850
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -843,6 +861,7 @@ function createImaController(video, options) {
|
|
|
843
861
|
adDisplayContainer = void 0;
|
|
844
862
|
adsLoader = void 0;
|
|
845
863
|
adVideoElement = void 0;
|
|
864
|
+
contentVideoHidden = false;
|
|
846
865
|
preloadedVast.clear();
|
|
847
866
|
preloadingVast.clear();
|
|
848
867
|
},
|