stormcloud-video-player 0.3.56 → 0.3.57

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.
@@ -742,7 +742,7 @@ function createImaController(video, options) {
742
742
  adVideo.style.height = "100%";
743
743
  adVideo.style.objectFit = "contain";
744
744
  adVideo.style.backgroundColor = "transparent";
745
- adVideo.style.zIndex = "15";
745
+ adVideo.style.zIndex = "2";
746
746
  adVideo.playsInline = true;
747
747
  adVideo.volume = originalVolume;
748
748
  adVideo.muted = originalMutedState;
@@ -1035,7 +1035,7 @@ function createImaController(video, options) {
1035
1035
  container.style.alignItems = "center";
1036
1036
  container.style.justifyContent = "center";
1037
1037
  container.style.pointerEvents = "none";
1038
- container.style.zIndex = "10";
1038
+ container.style.zIndex = "30";
1039
1039
  container.style.backgroundColor = "#000";
1040
1040
  container.style.transition = "opacity 0.3s ease-in-out";
1041
1041
  container.style.opacity = "0";
@@ -1150,7 +1150,7 @@ function createImaController(video, options) {
1150
1150
  container.style.alignItems = "center";
1151
1151
  container.style.justifyContent = "center";
1152
1152
  container.style.pointerEvents = "none";
1153
- container.style.zIndex = "10";
1153
+ container.style.zIndex = "30";
1154
1154
  container.style.backgroundColor = "transparent";
1155
1155
  container.style.transition = "opacity 0.3s ease-in-out, background-color 0.3s ease-in-out";
1156
1156
  container.style.opacity = "0";
@@ -2065,7 +2065,7 @@ function createHlsAdPlayer(contentVideo, options) {
2065
2065
  container.style.alignItems = "center";
2066
2066
  container.style.justifyContent = "center";
2067
2067
  container.style.pointerEvents = "none";
2068
- container.style.zIndex = "10";
2068
+ container.style.zIndex = "30";
2069
2069
  container.style.backgroundColor = "#000";
2070
2070
  (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
2071
2071
  adContainerEl = container;
@@ -3845,13 +3845,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3845
3845
  _this.activeAdRequestToken = null;
3846
3846
  _this.showAds = true;
3847
3847
  _this.resetGamNoFillCounter();
3848
- if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
3849
- if (_this.adStopTimerId == null) {
3850
- _this.currentAdBreakStartWallClockMs = Date.now();
3851
- _this.scheduleAdStopCountdown(_this.expectedAdBreakDurationMs);
3852
- if (_this.config.debugAdTiming) {
3853
- console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
3854
- }
3848
+ if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
3849
+ _this.scheduleAdStopCountdown(_this.getRemainingAdMs());
3850
+ if (_this.config.debugAdTiming) {
3851
+ console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
3855
3852
  }
3856
3853
  }
3857
3854
  var currentMuted = _this.video.muted;
@@ -3914,6 +3911,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3914
3911
  this.ima.showPlaceholder();
3915
3912
  this.isShowingPlaceholder = true;
3916
3913
  }
3914
+ var preservedMutedState = this.ima.getOriginalMutedState();
3915
+ var preservedVolumeState = this.ima.getOriginalVolume();
3917
3916
  if (this.ima) {
3918
3917
  try {
3919
3918
  this.ima.destroy();
@@ -3928,7 +3927,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3928
3927
  var continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
3929
3928
  this.ima = this.createAdPlayer(continueLiveStreamDuringAds);
3930
3929
  this.ima.initialize();
3931
- this.ima.updateOriginalMutedState(this.video.muted, this.video.volume);
3930
+ this.ima.updateOriginalMutedState(preservedMutedState, preservedVolumeState);
3932
3931
  this.attachImaEventListeners();
3933
3932
  if (shouldShowPlaceholder) {
3934
3933
  this.showPlaceholderLayer();
@@ -4244,12 +4243,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4244
4243
  }
4245
4244
  }
4246
4245
  if (this.inAdBreak) {
4247
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
4248
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4249
- if (this.config.debugAdTiming) {
4250
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
4246
+ if (marker.durationSeconds != null) {
4247
+ var newDurationMs = marker.durationSeconds * 1e3;
4248
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4249
+ this.expectedAdBreakDurationMs = newDurationMs;
4250
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4251
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4252
+ this.scheduleAdStopCountdown(remainingMs);
4253
+ if (this.config.debugAdTiming) {
4254
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4255
+ }
4251
4256
  }
4252
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
4253
4257
  }
4254
4258
  return;
4255
4259
  }
@@ -4325,9 +4329,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4325
4329
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4326
4330
  }
4327
4331
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4328
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4329
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4330
- this.scheduleAdStopCountdown(remainingMs);
4332
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4333
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4334
+ this.scheduleAdStopCountdown(remainingMs1);
4331
4335
  }
4332
4336
  if (!this.ima.isAdPlaying() && this.activeAdRequestToken === null && this.adRequestQueue.length > 0) {
4333
4337
  this.tryNextAvailableAdWithRateLimit();
@@ -4895,6 +4899,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4895
4899
  return this.totalAdsInBreak;
4896
4900
  }
4897
4901
  },
4902
+ {
4903
+ key: "getAdRemainingMs",
4904
+ value: function getAdRemainingMs() {
4905
+ return this.getRemainingAdMs();
4906
+ }
4907
+ },
4898
4908
  {
4899
4909
  key: "generateVastUrlsWithCorrelators",
4900
4910
  value: function generateVastUrlsWithCorrelators(baseUrl, count) {
@@ -5547,9 +5557,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5547
5557
  ];
5548
5558
  case 2:
5549
5559
  _state.sent();
5550
- if (this.expectedAdBreakDurationMs != null) {
5551
- this.currentAdBreakStartWallClockMs = Date.now();
5552
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
5560
+ if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
5561
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
5553
5562
  }
5554
5563
  adVolume = currentMuted ? 0 : currentVolume;
5555
5564
  this.ima.setAdVolume(adVolume);
@@ -5590,9 +5599,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5590
5599
  ];
5591
5600
  case 6:
5592
5601
  _state.sent();
5593
- if (this.expectedAdBreakDurationMs != null) {
5594
- this.currentAdBreakStartWallClockMs = Date.now();
5595
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
5602
+ if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
5603
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
5596
5604
  }
5597
5605
  adVolume1 = currentMuted ? 0 : currentVolume;
5598
5606
  this.ima.setAdVolume(adVolume1);
@@ -5646,9 +5654,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5646
5654
  ];
5647
5655
  case 10:
5648
5656
  _state.sent();
5649
- if (this.expectedAdBreakDurationMs != null) {
5650
- this.currentAdBreakStartWallClockMs = Date.now();
5651
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
5657
+ if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
5658
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
5652
5659
  }
5653
5660
  adVolume2 = currentMuted ? 0 : currentVolume;
5654
5661
  this.ima.setAdVolume(adVolume2);
@@ -5999,8 +6006,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5999
6006
  case 2:
6000
6007
  _state.sent();
6001
6008
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6002
- this.currentAdBreakStartWallClockMs = Date.now();
6003
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
6009
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
6004
6010
  }
6005
6011
  currentMuted = this.video.muted;
6006
6012
  currentVolume = this.video.volume;
@@ -6753,8 +6759,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6753
6759
  case 5:
6754
6760
  _state.sent();
6755
6761
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6756
- this.currentAdBreakStartWallClockMs = Date.now();
6757
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
6762
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
6758
6763
  }
6759
6764
  currentMuted = this.video.muted;
6760
6765
  currentVolume = this.video.volume;
@@ -6804,8 +6809,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
6804
6809
  case 8:
6805
6810
  _state.sent();
6806
6811
  if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
6807
- this.currentAdBreakStartWallClockMs = Date.now();
6808
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
6812
+ this.scheduleAdStopCountdown(this.getRemainingAdMs());
6809
6813
  }
6810
6814
  currentMuted1 = this.video.muted;
6811
6815
  currentVolume1 = this.video.volume;