stormcloud-video-player 0.7.22 → 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.
@@ -3044,31 +3044,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3044
3044
  this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
3045
3045
  var frag = data === null || data === void 0 ? void 0 : data.frag;
3046
3046
  if (!frag) return;
3047
- if (_this.lastAdInsertionPoint && !_this.inAdBreak && !_this.pendingAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3047
+ if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3048
3048
  var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
3049
3049
  if (_this.fragmentMatchesSegment(frag, segmentName)) {
3050
- var _ref;
3050
+ var _ref, _ref1;
3051
+ var _this_pendingAdBreak;
3051
3052
  _this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
3052
3053
  var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
3054
+ var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
3055
+ var withPrefetch = _this.pendingAdBreak != null;
3053
3056
  _this.pushAdInsertionDebug("segment_playing", segmentName, {
3054
3057
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3055
- detail: "sn=".concat((_ref = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref !== void 0 ? _ref : "?")
3058
+ detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
3056
3059
  });
3057
3060
  if (_this.config.debugAdTiming) {
3058
- console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
3061
+ 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)" : ""));
3059
3062
  }
3060
3063
  _this.pushAdInsertionDebug("ad_scheduled", segmentName, {
3061
3064
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3062
- detail: "in ".concat(offsetMs, "ms, dur=60s")
3065
+ detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
3063
3066
  });
3064
3067
  _this.clearAdInsertionOffsetTimer();
3065
3068
  _this.adInsertionOffsetTimerId = window.setTimeout(function() {
3066
3069
  _this.adInsertionOffsetTimerId = void 0;
3067
3070
  if (_this.inAdBreak) return;
3068
3071
  _this.pushAdInsertionDebug("ad_triggered", segmentName, {
3069
- detail: "ad break started (60s)"
3072
+ detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
3070
3073
  });
3071
- void _this.handleAdStart(60);
3074
+ void _this.handleAdStart(durationSeconds);
3072
3075
  }, offsetMs);
3073
3076
  }
3074
3077
  }
@@ -3936,7 +3939,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3936
3939
  this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
3937
3940
  offsetSeconds: data.offset_seconds,
3938
3941
  updatedAt: data.updated_at,
3939
- detail: "ch=".concat(data.channel_id, " id=").concat(data.id)
3942
+ detail: "ch=".concat(data.channel_id)
3940
3943
  });
3941
3944
  if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
3942
3945
  this.clearAdInsertionOffsetTimer();