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
|
@@ -198,6 +198,7 @@ function getBrowserConfigOverrides() {
|
|
|
198
198
|
// src/sdk/ima.ts
|
|
199
199
|
function createImaController(video, options) {
|
|
200
200
|
let adPlaying = false;
|
|
201
|
+
let contentVideoHidden = false;
|
|
201
202
|
let originalMutedState = false;
|
|
202
203
|
let originalVolume = typeof video.volume === "number" && !Number.isNaN(video.volume) ? Math.max(0, Math.min(1, video.volume)) : 1;
|
|
203
204
|
const listeners = /* @__PURE__ */ new Map();
|
|
@@ -211,6 +212,26 @@ function createImaController(video, options) {
|
|
|
211
212
|
delete video.dataset.stormcloudAdPlaying;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
215
|
+
function hideContentVideo() {
|
|
216
|
+
if (!contentVideoHidden) {
|
|
217
|
+
video.style.visibility = "hidden";
|
|
218
|
+
video.muted = true;
|
|
219
|
+
video.volume = 0;
|
|
220
|
+
contentVideoHidden = true;
|
|
221
|
+
console.log("[IMA] Content video hidden and muted");
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function showContentVideo() {
|
|
225
|
+
if (contentVideoHidden) {
|
|
226
|
+
video.style.visibility = "visible";
|
|
227
|
+
video.muted = originalMutedState;
|
|
228
|
+
video.volume = originalVolume;
|
|
229
|
+
contentVideoHidden = false;
|
|
230
|
+
console.log(
|
|
231
|
+
`[IMA] Content video restored (muted: ${originalMutedState}, volume: ${originalVolume})`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
214
235
|
function createAdVideoElement() {
|
|
215
236
|
const adVideo = document.createElement("video");
|
|
216
237
|
adVideo.style.position = "absolute";
|
|
@@ -219,11 +240,20 @@ function createImaController(video, options) {
|
|
|
219
240
|
adVideo.style.width = "100%";
|
|
220
241
|
adVideo.style.height = "100%";
|
|
221
242
|
adVideo.style.objectFit = "contain";
|
|
222
|
-
adVideo.style.backgroundColor = "
|
|
243
|
+
adVideo.style.backgroundColor = "transparent";
|
|
223
244
|
adVideo.style.zIndex = "15";
|
|
224
245
|
adVideo.playsInline = true;
|
|
225
246
|
adVideo.muted = false;
|
|
226
247
|
adVideo.volume = originalMutedState ? 0 : originalVolume;
|
|
248
|
+
adVideo.style.opacity = "0";
|
|
249
|
+
adVideo.addEventListener(
|
|
250
|
+
"canplay",
|
|
251
|
+
() => {
|
|
252
|
+
adVideo.style.opacity = "1";
|
|
253
|
+
console.log("[IMA] Ad video ready to play");
|
|
254
|
+
},
|
|
255
|
+
{ once: true }
|
|
256
|
+
);
|
|
227
257
|
console.log(
|
|
228
258
|
`[IMA] Created dedicated ad video element with volume: ${adVideo.volume}, muted: ${adVideo.muted}`
|
|
229
259
|
);
|
|
@@ -387,6 +417,9 @@ function createImaController(video, options) {
|
|
|
387
417
|
}
|
|
388
418
|
adsManager = void 0;
|
|
389
419
|
}
|
|
420
|
+
if (adVideoElement) {
|
|
421
|
+
adVideoElement.style.opacity = "0";
|
|
422
|
+
}
|
|
390
423
|
}
|
|
391
424
|
return {
|
|
392
425
|
initialize() {
|
|
@@ -537,11 +570,8 @@ function createImaController(video, options) {
|
|
|
537
570
|
console.error("[IMA] Ad error:", errorEvent.getError());
|
|
538
571
|
destroyAdsManager();
|
|
539
572
|
adPlaying = false;
|
|
540
|
-
|
|
573
|
+
showContentVideo();
|
|
541
574
|
setAdPlayingFlag(false);
|
|
542
|
-
console.log(
|
|
543
|
-
"[IMA] Restored main video visibility after ad error"
|
|
544
|
-
);
|
|
545
575
|
if (adContainerEl) {
|
|
546
576
|
adContainerEl.style.pointerEvents = "none";
|
|
547
577
|
adContainerEl.style.display = "none";
|
|
@@ -583,29 +613,24 @@ function createImaController(video, options) {
|
|
|
583
613
|
adsManager.addEventListener(
|
|
584
614
|
AdEvent.CONTENT_PAUSE_REQUESTED,
|
|
585
615
|
() => {
|
|
586
|
-
console.log(
|
|
587
|
-
"[IMA] Content pause requested - hiding main video, showing ad video"
|
|
588
|
-
);
|
|
616
|
+
console.log("[IMA] Content pause requested");
|
|
589
617
|
if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
590
618
|
video.pause();
|
|
591
619
|
console.log("[IMA] Content video paused (VOD mode)");
|
|
592
620
|
} else {
|
|
593
621
|
console.log(
|
|
594
|
-
"[IMA] Content video continues
|
|
622
|
+
"[IMA] Content video continues in background (Live mode)"
|
|
595
623
|
);
|
|
596
624
|
}
|
|
597
|
-
video.style.visibility = "hidden";
|
|
598
625
|
adPlaying = true;
|
|
599
626
|
setAdPlayingFlag(true);
|
|
600
627
|
emit("content_pause");
|
|
601
628
|
}
|
|
602
629
|
);
|
|
603
630
|
adsManager.addEventListener(AdEvent.STARTED, () => {
|
|
604
|
-
console.log(
|
|
605
|
-
"[IMA] Ad started playing - showing dedicated ad video"
|
|
606
|
-
);
|
|
631
|
+
console.log("[IMA] Ad started - showing ad video");
|
|
607
632
|
setAdPlayingFlag(true);
|
|
608
|
-
|
|
633
|
+
hideContentVideo();
|
|
609
634
|
if (adVideoElement) {
|
|
610
635
|
adVideoElement.volume = originalMutedState ? 0 : originalVolume;
|
|
611
636
|
adVideoElement.muted = originalMutedState;
|
|
@@ -616,32 +641,28 @@ function createImaController(video, options) {
|
|
|
616
641
|
if (adContainerEl) {
|
|
617
642
|
adContainerEl.style.pointerEvents = "auto";
|
|
618
643
|
adContainerEl.style.display = "flex";
|
|
619
|
-
console.log(
|
|
620
|
-
"[IMA] Ad container visible with dedicated ad video"
|
|
621
|
-
);
|
|
644
|
+
console.log("[IMA] Ad container now visible");
|
|
622
645
|
}
|
|
623
646
|
});
|
|
624
647
|
adsManager.addEventListener(
|
|
625
648
|
AdEvent.CONTENT_RESUME_REQUESTED,
|
|
626
649
|
() => {
|
|
627
|
-
console.log(
|
|
628
|
-
"[IMA] Content resume requested - showing main video"
|
|
629
|
-
);
|
|
650
|
+
console.log("[IMA] Content resume requested");
|
|
630
651
|
adPlaying = false;
|
|
631
652
|
setAdPlayingFlag(false);
|
|
632
|
-
|
|
653
|
+
showContentVideo();
|
|
633
654
|
emit("content_resume");
|
|
634
655
|
setTimeout(() => {
|
|
635
656
|
const stillInPod = video.dataset.stormcloudAdPlaying === "true";
|
|
636
657
|
if (stillInPod) {
|
|
637
658
|
console.log(
|
|
638
|
-
"[IMA] Still in ad pod - keeping ad
|
|
659
|
+
"[IMA] Still in ad pod - keeping ad container visible"
|
|
639
660
|
);
|
|
640
661
|
if (adContainerEl) {
|
|
641
662
|
adContainerEl.style.display = "flex";
|
|
642
663
|
adContainerEl.style.pointerEvents = "auto";
|
|
643
664
|
}
|
|
644
|
-
|
|
665
|
+
hideContentVideo();
|
|
645
666
|
}
|
|
646
667
|
}, 50);
|
|
647
668
|
}
|
|
@@ -661,7 +682,7 @@ function createImaController(video, options) {
|
|
|
661
682
|
} catch (e) {
|
|
662
683
|
console.error("[IMA] Error setting up ads manager:", e);
|
|
663
684
|
adPlaying = false;
|
|
664
|
-
|
|
685
|
+
showContentVideo();
|
|
665
686
|
setAdPlayingFlag(false);
|
|
666
687
|
if (adContainerEl) {
|
|
667
688
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -692,11 +713,8 @@ function createImaController(video, options) {
|
|
|
692
713
|
(adErrorEvent) => {
|
|
693
714
|
console.error("[IMA] Ads loader error:", adErrorEvent.getError());
|
|
694
715
|
adPlaying = false;
|
|
695
|
-
|
|
716
|
+
showContentVideo();
|
|
696
717
|
setAdPlayingFlag(false);
|
|
697
|
-
console.log(
|
|
698
|
-
"[IMA] Restored main video visibility after loader error"
|
|
699
|
-
);
|
|
700
718
|
if (adContainerEl) {
|
|
701
719
|
adContainerEl.style.pointerEvents = "none";
|
|
702
720
|
adContainerEl.style.display = "none";
|
|
@@ -807,7 +825,7 @@ function createImaController(video, options) {
|
|
|
807
825
|
console.log("[IMA] Stopping ad playback");
|
|
808
826
|
adPlaying = false;
|
|
809
827
|
setAdPlayingFlag(false);
|
|
810
|
-
|
|
828
|
+
showContentVideo();
|
|
811
829
|
if (adContainerEl) {
|
|
812
830
|
adContainerEl.style.pointerEvents = "none";
|
|
813
831
|
adContainerEl.style.display = "none";
|
|
@@ -823,7 +841,7 @@ function createImaController(video, options) {
|
|
|
823
841
|
var _a;
|
|
824
842
|
destroyAdsManager();
|
|
825
843
|
adPlaying = false;
|
|
826
|
-
|
|
844
|
+
showContentVideo();
|
|
827
845
|
setAdPlayingFlag(false);
|
|
828
846
|
if (adContainerEl) {
|
|
829
847
|
adContainerEl.style.pointerEvents = "none";
|
|
@@ -840,6 +858,7 @@ function createImaController(video, options) {
|
|
|
840
858
|
adDisplayContainer = void 0;
|
|
841
859
|
adsLoader = void 0;
|
|
842
860
|
adVideoElement = void 0;
|
|
861
|
+
contentVideoHidden = false;
|
|
843
862
|
preloadedVast.clear();
|
|
844
863
|
preloadingVast.clear();
|
|
845
864
|
},
|