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.cjs CHANGED
@@ -1197,6 +1197,14 @@ function createVastAdLayer(contentVideo, options) {
1197
1197
  } else if (debug) {
1198
1198
  console.warn("".concat(LOG, " forceMP4Ads: no MP4 files available, falling back to all media files"));
1199
1199
  }
1200
+ } else {
1201
+ var mp4Only1 = candidates.filter(function(f) {
1202
+ return !isHlsMediaFile(f);
1203
+ });
1204
+ if (mp4Only1.length > 0) {
1205
+ candidates = mp4Only1;
1206
+ if (debug) console.log("".concat(LOG, " Preferring ").concat(mp4Only1.length, " MP4 file(s) over HLS (mp4-first)"));
1207
+ }
1200
1208
  }
1201
1209
  var firstFile = candidates[0];
1202
1210
  if (candidates.length === 1) return firstFile;
@@ -4157,12 +4165,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4157
4165
  }
4158
4166
  }
4159
4167
  if (this.inAdBreak) {
4160
- if (this.expectedAdBreakDurationMs == null && marker.durationSeconds != null) {
4161
- this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4162
- if (this.config.debugAdTiming) {
4163
- console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(this.expectedAdBreakDurationMs, "ms"));
4168
+ if (marker.durationSeconds != null) {
4169
+ var newDurationMs = marker.durationSeconds * 1e3;
4170
+ if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
4171
+ this.expectedAdBreakDurationMs = newDurationMs;
4172
+ var elapsedMs = this.currentAdBreakStartWallClockMs != null ? Date.now() - this.currentAdBreakStartWallClockMs : 0;
4173
+ var remainingMs = Math.max(0, newDurationMs - elapsedMs);
4174
+ this.scheduleAdStopCountdown(remainingMs);
4175
+ if (this.config.debugAdTiming) {
4176
+ console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(remainingMs, "ms"));
4177
+ }
4164
4178
  }
4165
- this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
4166
4179
  }
4167
4180
  return;
4168
4181
  }
@@ -4243,9 +4256,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4243
4256
  this.expectedAdBreakDurationMs = marker.durationSeconds * 1e3;
4244
4257
  }
4245
4258
  if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
4246
- var elapsedMs = Date.now() - this.currentAdBreakStartWallClockMs;
4247
- var remainingMs = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs);
4248
- this.scheduleAdStopCountdown(remainingMs);
4259
+ var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
4260
+ var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
4261
+ this.scheduleAdStopCountdown(remainingMs1);
4249
4262
  }
4250
4263
  if (!this.adLayer.isAdPlaying() && this.pendingNextAdBids != null && this.pendingNextAdBids.length > 0) {
4251
4264
  var bids = this.pendingNextAdBids;