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.
@@ -501,7 +501,9 @@ function createImaController(video, options) {
501
501
  adsManager.addEventListener(
502
502
  AdEvent.CONTENT_PAUSE_REQUESTED,
503
503
  () => {
504
- console.log("[IMA] Content pause requested");
504
+ console.log(
505
+ "[IMA] Content pause requested - FORCE MUTING main video"
506
+ );
505
507
  if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
506
508
  video.pause();
507
509
  console.log("[IMA] Video paused (VOD mode)");
@@ -511,14 +513,19 @@ function createImaController(video, options) {
511
513
  );
512
514
  }
513
515
  video.muted = true;
516
+ video.volume = 0;
514
517
  adPlaying = true;
515
518
  setAdPlayingFlag(true);
516
519
  emit("content_pause");
517
520
  }
518
521
  );
519
522
  adsManager.addEventListener(AdEvent.STARTED, () => {
520
- console.log("[IMA] Ad started playing");
523
+ console.log(
524
+ "[IMA] Ad started playing - FORCE MUTING main video"
525
+ );
521
526
  setAdPlayingFlag(true);
527
+ video.muted = true;
528
+ video.volume = 0;
522
529
  if (adContainerEl) {
523
530
  adContainerEl.style.pointerEvents = "auto";
524
531
  adContainerEl.style.display = "flex";
@@ -534,6 +541,18 @@ function createImaController(video, options) {
534
541
  adPlaying = false;
535
542
  setAdPlayingFlag(false);
536
543
  emit("content_resume");
544
+ setTimeout(() => {
545
+ const stillInPod = video.dataset.stormcloudAdPlaying === "true";
546
+ if (stillInPod) {
547
+ console.log(
548
+ "[IMA] Still in ad pod - keeping ad container visible (black screen)"
549
+ );
550
+ if (adContainerEl) {
551
+ adContainerEl.style.display = "flex";
552
+ adContainerEl.style.pointerEvents = "auto";
553
+ }
554
+ }
555
+ }, 50);
537
556
  }
538
557
  );
539
558
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
@@ -1083,6 +1102,18 @@ function createHlsAdPlayer(contentVideo, options) {
1083
1102
  adPlaying = false;
1084
1103
  setAdPlayingFlag(false);
1085
1104
  emit("content_resume");
1105
+ setTimeout(() => {
1106
+ const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
1107
+ if (stillInPod) {
1108
+ console.log(
1109
+ "[HlsAdPlayer] Still in ad pod - keeping ad container visible (black screen)"
1110
+ );
1111
+ if (adContainerEl) {
1112
+ adContainerEl.style.display = "flex";
1113
+ adContainerEl.style.pointerEvents = "auto";
1114
+ }
1115
+ }
1116
+ }, 50);
1086
1117
  }
1087
1118
  function handleAdError() {
1088
1119
  console.log("[HlsAdPlayer] Handling ad error");
@@ -1194,7 +1225,9 @@ function createHlsAdPlayer(contentVideo, options) {
1194
1225
  } else {
1195
1226
  console.log("[HlsAdPlayer] Content continues (Live mode)");
1196
1227
  }
1228
+ console.log("[HlsAdPlayer] FORCE MUTING main video");
1197
1229
  contentVideo.muted = true;
1230
+ contentVideo.volume = 0;
1198
1231
  adPlaying = true;
1199
1232
  setAdPlayingFlag(true);
1200
1233
  if (adVideoElement) {
@@ -2139,6 +2172,9 @@ var StormcloudVideoPlayer = class {
2139
2172
  if (remaining > 500 && this.adPodQueue.length > 0) {
2140
2173
  const next = this.adPodQueue.shift();
2141
2174
  this.currentAdIndex++;
2175
+ this.video.dataset.stormcloudAdPlaying = "true";
2176
+ this.video.muted = true;
2177
+ this.video.volume = 0;
2142
2178
  if (this.config.debugAdTiming) {
2143
2179
  console.log(
2144
2180
  `[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - main video stays muted, ad layer stays visible`
@@ -2971,7 +3007,7 @@ var StormcloudVideoPlayer = class {
2971
3007
  var _a;
2972
3008
  if (this.config.debugAdTiming) {
2973
3009
  console.log(
2974
- "[StormcloudVideoPlayer] Handling ad pod completion - resuming content"
3010
+ "[StormcloudVideoPlayer] Handling ad pod completion - resuming content and hiding ad layer"
2975
3011
  );
2976
3012
  }
2977
3013
  this.inAdBreak = false;
@@ -2984,11 +3020,14 @@ var StormcloudVideoPlayer = class {
2984
3020
  this.showAds = false;
2985
3021
  this.currentAdIndex = 0;
2986
3022
  this.totalAdsInBreak = 0;
3023
+ this.ima.stop().catch(() => {
3024
+ });
2987
3025
  const originalMutedState = this.ima.getOriginalMutedState();
2988
3026
  this.video.muted = originalMutedState;
3027
+ this.video.volume = originalMutedState ? 0 : 1;
2989
3028
  if (this.config.debugAdTiming) {
2990
3029
  console.log(
2991
- `[StormcloudVideoPlayer] Restored main video mute state to: ${originalMutedState}`
3030
+ `[StormcloudVideoPlayer] Restored main video - muted: ${originalMutedState}, volume: ${this.video.volume}`
2992
3031
  );
2993
3032
  }
2994
3033
  if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {