stormcloud-video-player 0.2.21 → 0.2.23

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.
@@ -540,7 +540,9 @@ function createImaController(video, options) {
540
540
  adsManager.addEventListener(
541
541
  AdEvent.CONTENT_PAUSE_REQUESTED,
542
542
  () => {
543
- console.log("[IMA] Content pause requested");
543
+ console.log(
544
+ "[IMA] Content pause requested - FORCE MUTING main video"
545
+ );
544
546
  if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
545
547
  video.pause();
546
548
  console.log("[IMA] Video paused (VOD mode)");
@@ -550,14 +552,19 @@ function createImaController(video, options) {
550
552
  );
551
553
  }
552
554
  video.muted = true;
555
+ video.volume = 0;
553
556
  adPlaying = true;
554
557
  setAdPlayingFlag(true);
555
558
  emit("content_pause");
556
559
  }
557
560
  );
558
561
  adsManager.addEventListener(AdEvent.STARTED, () => {
559
- console.log("[IMA] Ad started playing");
562
+ console.log(
563
+ "[IMA] Ad started playing - FORCE MUTING main video"
564
+ );
560
565
  setAdPlayingFlag(true);
566
+ video.muted = true;
567
+ video.volume = 0;
561
568
  if (adContainerEl) {
562
569
  adContainerEl.style.pointerEvents = "auto";
563
570
  adContainerEl.style.display = "flex";
@@ -573,6 +580,18 @@ function createImaController(video, options) {
573
580
  adPlaying = false;
574
581
  setAdPlayingFlag(false);
575
582
  emit("content_resume");
583
+ setTimeout(() => {
584
+ const stillInPod = video.dataset.stormcloudAdPlaying === "true";
585
+ if (stillInPod) {
586
+ console.log(
587
+ "[IMA] Still in ad pod - keeping ad container visible (black screen)"
588
+ );
589
+ if (adContainerEl) {
590
+ adContainerEl.style.display = "flex";
591
+ adContainerEl.style.pointerEvents = "auto";
592
+ }
593
+ }
594
+ }, 50);
576
595
  }
577
596
  );
578
597
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
@@ -1122,6 +1141,18 @@ function createHlsAdPlayer(contentVideo, options) {
1122
1141
  adPlaying = false;
1123
1142
  setAdPlayingFlag(false);
1124
1143
  emit("content_resume");
1144
+ setTimeout(() => {
1145
+ const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
1146
+ if (stillInPod) {
1147
+ console.log(
1148
+ "[HlsAdPlayer] Still in ad pod - keeping ad container visible (black screen)"
1149
+ );
1150
+ if (adContainerEl) {
1151
+ adContainerEl.style.display = "flex";
1152
+ adContainerEl.style.pointerEvents = "auto";
1153
+ }
1154
+ }
1155
+ }, 50);
1125
1156
  }
1126
1157
  function handleAdError() {
1127
1158
  console.log("[HlsAdPlayer] Handling ad error");
@@ -1233,7 +1264,9 @@ function createHlsAdPlayer(contentVideo, options) {
1233
1264
  } else {
1234
1265
  console.log("[HlsAdPlayer] Content continues (Live mode)");
1235
1266
  }
1267
+ console.log("[HlsAdPlayer] FORCE MUTING main video");
1236
1268
  contentVideo.muted = true;
1269
+ contentVideo.volume = 0;
1237
1270
  adPlaying = true;
1238
1271
  setAdPlayingFlag(true);
1239
1272
  if (adVideoElement) {
@@ -2178,6 +2211,9 @@ var StormcloudVideoPlayer = class {
2178
2211
  if (remaining > 500 && this.adPodQueue.length > 0) {
2179
2212
  const next = this.adPodQueue.shift();
2180
2213
  this.currentAdIndex++;
2214
+ this.video.dataset.stormcloudAdPlaying = "true";
2215
+ this.video.muted = true;
2216
+ this.video.volume = 0;
2181
2217
  if (this.config.debugAdTiming) {
2182
2218
  console.log(
2183
2219
  `[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - main video stays muted, ad layer stays visible`
@@ -3010,7 +3046,7 @@ var StormcloudVideoPlayer = class {
3010
3046
  var _a;
3011
3047
  if (this.config.debugAdTiming) {
3012
3048
  console.log(
3013
- "[StormcloudVideoPlayer] Handling ad pod completion - resuming content"
3049
+ "[StormcloudVideoPlayer] Handling ad pod completion - resuming content and hiding ad layer"
3014
3050
  );
3015
3051
  }
3016
3052
  this.inAdBreak = false;
@@ -3023,11 +3059,14 @@ var StormcloudVideoPlayer = class {
3023
3059
  this.showAds = false;
3024
3060
  this.currentAdIndex = 0;
3025
3061
  this.totalAdsInBreak = 0;
3062
+ this.ima.stop().catch(() => {
3063
+ });
3026
3064
  const originalMutedState = this.ima.getOriginalMutedState();
3027
3065
  this.video.muted = originalMutedState;
3066
+ this.video.volume = originalMutedState ? 0 : 1;
3028
3067
  if (this.config.debugAdTiming) {
3029
3068
  console.log(
3030
- `[StormcloudVideoPlayer] Restored main video mute state to: ${originalMutedState}`
3069
+ `[StormcloudVideoPlayer] Restored main video - muted: ${originalMutedState}, volume: ${this.video.volume}`
3031
3070
  );
3032
3071
  }
3033
3072
  if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {