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.
package/lib/index.js CHANGED
@@ -1037,6 +1037,14 @@ function createVastAdLayer(contentVideo, options) {
1037
1037
  } else if (debug) {
1038
1038
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
1039
1039
  }
1040
+ } else {
1041
+ var mp4Only1 = candidates.filter(function(f) {
1042
+ return !isHlsMediaFile(f);
1043
+ });
1044
+ if (mp4Only1.length > 0) {
1045
+ candidates = mp4Only1;
1046
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
1047
+ }
1040
1048
  }
1041
1049
  var firstFile = candidates[0];
1042
1050
  if (candidates.length === 1) return firstFile;
@@ -4000,12 +4008,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4000
4008
  }
4001
4009
  }
4002
4010
  if (this.inAdBreak) {
4003
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
4004
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4005
- if (this.config.debugAdTiming) {
4006
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
4011
+ if (marker.durationSeconds != null) {
4012
+ var newDurationMs = marker.durationSeconds * 1e3;
4013
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4014
+ this.expectedAdBreakDurationMs = newDurationMs;
4015
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4016
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4017
+ this.scheduleAdStopCountdown(remainingMs);
4018
+ if (this.config.debugAdTiming) {
4019
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4020
+ }
4007
4021
  }
4008
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
4009
4022
  }
4010
4023
  return;
4011
4024
  }
@@ -4086,9 +4099,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4086
4099
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4087
4100
  }
4088
4101
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4089
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4090
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4091
- this.scheduleAdStopCountdown(remainingMs);
4102
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4103
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4104
+ this.scheduleAdStopCountdown(remainingMs1);
4092
4105
  }
4093
4106
  if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
4094
4107
  var bids = this.pendingNextAdBids;