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.
@@ -498,7 +498,9 @@ function createImaController(video, options) {
498
498
  adsManager.addEventListener(
499
499
  AdEvent.CONTENT_PAUSE_REQUESTED,
500
500
  () => {
501
- console.log("[IMA] Content pause requested");
501
+ console.log(
502
+ "[IMA] Content pause requested - FORCE MUTING main video"
503
+ );
502
504
  if (!(options == null ? void 0 : options.continueLiveStreamDuringAds)) {
503
505
  video.pause();
504
506
  console.log("[IMA] Video paused (VOD mode)");
@@ -508,14 +510,19 @@ function createImaController(video, options) {
508
510
  );
509
511
  }
510
512
  video.muted = true;
513
+ video.volume = 0;
511
514
  adPlaying = true;
512
515
  setAdPlayingFlag(true);
513
516
  emit("content_pause");
514
517
  }
515
518
  );
516
519
  adsManager.addEventListener(AdEvent.STARTED, () => {
517
- console.log("[IMA] Ad started playing");
520
+ console.log(
521
+ "[IMA] Ad started playing - FORCE MUTING main video"
522
+ );
518
523
  setAdPlayingFlag(true);
524
+ video.muted = true;
525
+ video.volume = 0;
519
526
  if (adContainerEl) {
520
527
  adContainerEl.style.pointerEvents = "auto";
521
528
  adContainerEl.style.display = "flex";
@@ -531,6 +538,18 @@ function createImaController(video, options) {
531
538
  adPlaying = false;
532
539
  setAdPlayingFlag(false);
533
540
  emit("content_resume");
541
+ setTimeout(() => {
542
+ const stillInPod = video.dataset.stormcloudAdPlaying === "true";
543
+ if (stillInPod) {
544
+ console.log(
545
+ "[IMA] Still in ad pod - keeping ad container visible (black screen)"
546
+ );
547
+ if (adContainerEl) {
548
+ adContainerEl.style.display = "flex";
549
+ adContainerEl.style.pointerEvents = "auto";
550
+ }
551
+ }
552
+ }, 50);
534
553
  }
535
554
  );
536
555
  adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, () => {
@@ -1080,6 +1099,18 @@ function createHlsAdPlayer(contentVideo, options) {
1080
1099
  adPlaying = false;
1081
1100
  setAdPlayingFlag(false);
1082
1101
  emit("content_resume");
1102
+ setTimeout(() => {
1103
+ const stillInPod = contentVideo.dataset.stormcloudAdPlaying === "true";
1104
+ if (stillInPod) {
1105
+ console.log(
1106
+ "[HlsAdPlayer] Still in ad pod - keeping ad container visible (black screen)"
1107
+ );
1108
+ if (adContainerEl) {
1109
+ adContainerEl.style.display = "flex";
1110
+ adContainerEl.style.pointerEvents = "auto";
1111
+ }
1112
+ }
1113
+ }, 50);
1083
1114
  }
1084
1115
  function handleAdError() {
1085
1116
  console.log("[HlsAdPlayer] Handling ad error");
@@ -1191,7 +1222,9 @@ function createHlsAdPlayer(contentVideo, options) {
1191
1222
  } else {
1192
1223
  console.log("[HlsAdPlayer] Content continues (Live mode)");
1193
1224
  }
1225
+ console.log("[HlsAdPlayer] FORCE MUTING main video");
1194
1226
  contentVideo.muted = true;
1227
+ contentVideo.volume = 0;
1195
1228
  adPlaying = true;
1196
1229
  setAdPlayingFlag(true);
1197
1230
  if (adVideoElement) {
@@ -2136,6 +2169,9 @@ var StormcloudVideoPlayer = class {
2136
2169
  if (remaining > 500 && this.adPodQueue.length > 0) {
2137
2170
  const next = this.adPodQueue.shift();
2138
2171
  this.currentAdIndex++;
2172
+ this.video.dataset.stormcloudAdPlaying = "true";
2173
+ this.video.muted = true;
2174
+ this.video.volume = 0;
2139
2175
  if (this.config.debugAdTiming) {
2140
2176
  console.log(
2141
2177
  `[StormcloudVideoPlayer] Playing next ad in pod (${this.currentAdIndex}/${this.totalAdsInBreak}) - main video stays muted, ad layer stays visible`
@@ -2968,7 +3004,7 @@ var StormcloudVideoPlayer = class {
2968
3004
  var _a;
2969
3005
  if (this.config.debugAdTiming) {
2970
3006
  console.log(
2971
- "[StormcloudVideoPlayer] Handling ad pod completion - resuming content"
3007
+ "[StormcloudVideoPlayer] Handling ad pod completion - resuming content and hiding ad layer"
2972
3008
  );
2973
3009
  }
2974
3010
  this.inAdBreak = false;
@@ -2981,11 +3017,14 @@ var StormcloudVideoPlayer = class {
2981
3017
  this.showAds = false;
2982
3018
  this.currentAdIndex = 0;
2983
3019
  this.totalAdsInBreak = 0;
3020
+ this.ima.stop().catch(() => {
3021
+ });
2984
3022
  const originalMutedState = this.ima.getOriginalMutedState();
2985
3023
  this.video.muted = originalMutedState;
3024
+ this.video.volume = originalMutedState ? 0 : 1;
2986
3025
  if (this.config.debugAdTiming) {
2987
3026
  console.log(
2988
- `[StormcloudVideoPlayer] Restored main video mute state to: ${originalMutedState}`
3027
+ `[StormcloudVideoPlayer] Restored main video - muted: ${originalMutedState}, volume: ${this.video.volume}`
2989
3028
  );
2990
3029
  }
2991
3030
  if (!this.shouldContinueLiveStreamDuringAds() && this.video.paused) {