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.
package/lib/index.cjs CHANGED
@@ -565,7 +565,9 @@ function createImaController(video, options) {
565
565
  adsManager.addEventListener(
566
566
  AdEvent.CONTENT_PAUSE_REQUESTED,
567
567
  () => {
568
- console.log("[IMA] Content pause requested");
568
+ console.log(
569
+ "[IMA] Content pause requested - FORCE MUTING main video"
570
+ );
569
571
  if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
570
572
  video.pause();
571
573
  console.log("[IMA] Video paused (VOD mode)");
@@ -575,14 +577,19 @@ function createImaController(video, options) {
575
577
  );
576
578
  }
577
579
  video.muted = true;
580
+ video.volume = 0;
578
581
  adPlaying = true;
579
582
  setAdPlayingFlag(true);
580
583
  emit("content_pause");
581
584
  }
582
585
  );
583
586
  adsManager.addEventListener(AdEvent.STARTED, () => {
584
- console.log("[IMA] Ad started playing");
587
+ console.log(
588
+ "[IMA] Ad started playing - FORCE MUTING main video"
589
+ );
585
590
  setAdPlayingFlag(true);
591
+ video.muted = true;
592
+ video.volume = 0;
586
593
  if (adContainerEl) {
587
594
  adContainerEl.style.pointerEvents = "auto";
588
595
  adContainerEl.style.display = "flex";
@@ -598,6 +605,18 @@ function createImaController(video, options) {
598
605
  adPlaying = false;
599
606
  setAdPlayingFlag(false);
600
607
  emit("content_resume");
608
+ setTimeout(() => {
609
+ const stillInPod = video.dataset.stormcloudAdPlaying === "true";
610
+ if (stillInPod) {
611
+ console.log(
612
+ "[IMA] Still in ad pod - keeping ad container visible (black screen)"
613
+ );
614
+ if (adContainerEl) {
615
+ adContainerEl.style.display = "flex";
616
+ adContainerEl.style.pointerEvents = "auto";
617
+ }
618
+ }
619
+ }, 50);
601
620
  }
602
621
  );
603
622
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
@@ -1147,6 +1166,18 @@ function createHlsAdPlayer(contentVideo, options) {
1147
1166
  adPlaying = false;
1148
1167
  setAdPlayingFlag(false);
1149
1168
  emit("content_resume");
1169
+ setTimeout(() => {
1170
+ const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
1171
+ if (stillInPod) {
1172
+ console.log(
1173
+ "[HlsAdPlayer] Still in ad pod - keeping ad container visible (black screen)"
1174
+ );
1175
+ if (adContainerEl) {
1176
+ adContainerEl.style.display = "flex";
1177
+ adContainerEl.style.pointerEvents = "auto";
1178
+ }
1179
+ }
1180
+ }, 50);
1150
1181
  }
1151
1182
  function handleAdError() {
1152
1183
  console.log("[HlsAdPlayer] Handling ad error");
@@ -1258,7 +1289,9 @@ function createHlsAdPlayer(contentVideo, options) {
1258
1289
  } else {
1259
1290
  console.log("[HlsAdPlayer] Content continues (Live mode)");
1260
1291
  }
1292
+ console.log("[HlsAdPlayer] FORCE MUTING main video");
1261
1293
  contentVideo.muted = true;
1294
+ contentVideo.volume = 0;
1262
1295
  adPlaying = true;
1263
1296
  setAdPlayingFlag(true);
1264
1297
  if (adVideoElement) {
@@ -2203,6 +2236,9 @@ var StormcloudVideoPlayer = class {
2203
2236
  if (remaining > 500 && this.adPodQueue.length > 0) {
2204
2237
  const next = this.adPodQueue.shift();
2205
2238
  this.currentAdIndex++;
2239
+ this.video.dataset.stormcloudAdPlaying = "true";
2240
+ this.video.muted = true;
2241
+ this.video.volume = 0;
2206
2242
  if (this.config.debugAdTiming) {
2207
2243
  console.log(
2208
2244
  `[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - main video stays muted, ad layer stays visible`
@@ -3035,7 +3071,7 @@ var StormcloudVideoPlayer = class {
3035
3071
  var _a;
3036
3072
  if (this.config.debugAdTiming) {
3037
3073
  console.log(
3038
- "[StormcloudVideoPlayer] Handling ad pod completion - resuming content"
3074
+ "[StormcloudVideoPlayer] Handling ad pod completion - resuming content and hiding ad layer"
3039
3075
  );
3040
3076
  }
3041
3077
  this.inAdBreak = false;
@@ -3048,11 +3084,14 @@ var StormcloudVideoPlayer = class {
3048
3084
  this.showAds = false;
3049
3085
  this.currentAdIndex = 0;
3050
3086
  this.totalAdsInBreak = 0;
3087
+ this.ima.stop().catch(() => {
3088
+ });
3051
3089
  const originalMutedState = this.ima.getOriginalMutedState();
3052
3090
  this.video.muted = originalMutedState;
3091
+ this.video.volume = originalMutedState ? 0 : 1;
3053
3092
  if (this.config.debugAdTiming) {
3054
3093
  console.log(
3055
- `[StormcloudVideoPlayer] Restored main video mute state to: ${originalMutedState}`
3094
+ `[StormcloudVideoPlayer] Restored main video - muted: ${originalMutedState}, volume: ${this.video.volume}`
3056
3095
  );
3057
3096
  }
3058
3097
  if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {