stormcloud-video-player 0.6.4 → 0.6.5

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.
@@ -1053,6 +1053,14 @@ function createVastAdLayer(contentVideo, options) {
1053
1053
  } else if (debug) {
1054
1054
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
1055
1055
  }
1056
+ } else {
1057
+ var mp4Only1 = candidates.filter(function(f) {
1058
+ return !isHlsMediaFile(f);
1059
+ });
1060
+ if (mp4Only1.length > 0) {
1061
+ candidates = mp4Only1;
1062
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
1063
+ }
1056
1064
  }
1057
1065
  var firstFile = candidates[0];
1058
1066
  if (candidates.length === 1) return firstFile;
@@ -3988,12 +3996,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3988
3996
  }
3989
3997
  }
3990
3998
  if (this.inAdBreak) {
3991
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
3992
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
3993
- if (this.config.debugAdTiming) {
3994
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
3999
+ if (marker.durationSeconds != null) {
4000
+ var newDurationMs = marker.durationSeconds * 1e3;
4001
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4002
+ this.expectedAdBreakDurationMs = newDurationMs;
4003
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4004
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4005
+ this.scheduleAdStopCountdown(remainingMs);
4006
+ if (this.config.debugAdTiming) {
4007
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4008
+ }
3995
4009
  }
3996
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
3997
4010
  }
3998
4011
  return;
3999
4012
  }
@@ -4074,9 +4087,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4074
4087
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4075
4088
  }
4076
4089
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4077
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4078
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4079
- this.scheduleAdStopCountdown(remainingMs);
4090
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4091
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4092
+ this.scheduleAdStopCountdown(remainingMs1);
4080
4093
  }
4081
4094
  if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
4082
4095
  var bids = this.pendingNextAdBids;