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.
@@ -1103,6 +1103,14 @@ function createVastAdLayer(contentVideo, options) {
1103
1103
  } else if (debug) {
1104
1104
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
1105
1105
  }
1106
+ } else {
1107
+ var mp4Only1 = candidates.filter(function(f) {
1108
+ return !isHlsMediaFile(f);
1109
+ });
1110
+ if (mp4Only1.length > 0) {
1111
+ candidates = mp4Only1;
1112
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
1113
+ }
1106
1114
  }
1107
1115
  var firstFile = candidates[0];
1108
1116
  if (candidates.length === 1) return firstFile;
@@ -4038,12 +4046,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4038
4046
  }
4039
4047
  }
4040
4048
  if (this.inAdBreak) {
4041
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
4042
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4043
- if (this.config.debugAdTiming) {
4044
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
4049
+ if (marker.durationSeconds != null) {
4050
+ var newDurationMs = marker.durationSeconds * 1e3;
4051
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4052
+ this.expectedAdBreakDurationMs = newDurationMs;
4053
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4054
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4055
+ this.scheduleAdStopCountdown(remainingMs);
4056
+ if (this.config.debugAdTiming) {
4057
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4058
+ }
4045
4059
  }
4046
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
4047
4060
  }
4048
4061
  return;
4049
4062
  }
@@ -4124,9 +4137,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4124
4137
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4125
4138
  }
4126
4139
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4127
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4128
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4129
- this.scheduleAdStopCountdown(remainingMs);
4140
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4141
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4142
+ this.scheduleAdStopCountdown(remainingMs1);
4130
4143
  }
4131
4144
  if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
4132
4145
  var bids = this.pendingNextAdBids;