stormcloud-video-player 0.7.23 → 0.7.24

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.
@@ -3080,31 +3080,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3080
3080
  this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
3081
3081
  var frag = data === null || data === void 0 ? void 0 : data.frag;
3082
3082
  if (!frag) return;
3083
- if (_this.lastAdInsertionPoint && !_this.inAdBreak && !_this.pendingAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3083
+ if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3084
3084
  var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
3085
3085
  if (_this.fragmentMatchesSegment(frag, segmentName)) {
3086
- var _ref;
3086
+ var _ref, _ref1;
3087
+ var _this_pendingAdBreak;
3087
3088
  _this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
3088
3089
  var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
3090
+ var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
3091
+ var withPrefetch = _this.pendingAdBreak != null;
3089
3092
  _this.pushAdInsertionDebug("segment_playing", segmentName, {
3090
3093
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3091
- detail: "sn=".concat((_ref = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref !== void 0 ? _ref : "?")
3094
+ detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
3092
3095
  });
3093
3096
  if (_this.config.debugAdTiming) {
3094
- console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
3097
+ console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms") + (withPrefetch ? " (prefetch was active, preloaded tokens will be used)" : ""));
3095
3098
  }
3096
3099
  _this.pushAdInsertionDebug("ad_scheduled", segmentName, {
3097
3100
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3098
- detail: "in ".concat(offsetMs, "ms, dur=60s")
3101
+ detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
3099
3102
  });
3100
3103
  _this.clearAdInsertionOffsetTimer();
3101
3104
  _this.adInsertionOffsetTimerId = window.setTimeout(function() {
3102
3105
  _this.adInsertionOffsetTimerId = void 0;
3103
3106
  if (_this.inAdBreak) return;
3104
3107
  _this.pushAdInsertionDebug("ad_triggered", segmentName, {
3105
- detail: "ad break started (60s)"
3108
+ detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
3106
3109
  });
3107
- void _this.handleAdStart(60);
3110
+ void _this.handleAdStart(durationSeconds);
3108
3111
  }, offsetMs);
3109
3112
  }
3110
3113
  }
@@ -3972,7 +3975,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3972
3975
  this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
3973
3976
  offsetSeconds: data.offset_seconds,
3974
3977
  updatedAt: data.updated_at,
3975
- detail: "ch=".concat(data.channel_id, " id=").concat(data.id)
3978
+ detail: "ch=".concat(data.channel_id)
3976
3979
  });
3977
3980
  if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
3978
3981
  this.clearAdInsertionOffsetTimer();