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