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.
@@ -1067,6 +1067,14 @@ function createVastAdLayer(contentVideo, options) {
1067
1067
  } else if (debug) {
1068
1068
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
1069
1069
  }
1070
+ } else {
1071
+ var mp4Only1 = candidates.filter(function(f) {
1072
+ return !isHlsMediaFile(f);
1073
+ });
1074
+ if (mp4Only1.length > 0) {
1075
+ candidates = mp4Only1;
1076
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
1077
+ }
1070
1078
  }
1071
1079
  var firstFile = candidates[0];
1072
1080
  if (candidates.length === 1) return firstFile;
@@ -4002,12 +4010,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4002
4010
  }
4003
4011
  }
4004
4012
  if (this.inAdBreak) {
4005
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
4006
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4007
- if (this.config.debugAdTiming) {
4008
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
4013
+ if (marker.durationSeconds != null) {
4014
+ var newDurationMs = marker.durationSeconds * 1e3;
4015
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4016
+ this.expectedAdBreakDurationMs = newDurationMs;
4017
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4018
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4019
+ this.scheduleAdStopCountdown(remainingMs);
4020
+ if (this.config.debugAdTiming) {
4021
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4022
+ }
4009
4023
  }
4010
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
4011
4024
  }
4012
4025
  return;
4013
4026
  }
@@ -4088,9 +4101,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4088
4101
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4089
4102
  }
4090
4103
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4091
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4092
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4093
- this.scheduleAdStopCountdown(remainingMs);
4104
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4105
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4106
+ this.scheduleAdStopCountdown(remainingMs1);
4094
4107
  }
4095
4108
  if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
4096
4109
  var bids = this.pendingNextAdBids;