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.
@@ -3030,31 +3030,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3030
3030
  this.hls.on(import_hls.default.Events.FRAG_CHANGED, function(_evt, data) {
3031
3031
  var frag = data === null || data === void 0 ? void 0 : data.frag;
3032
3032
  if (!frag) return;
3033
- if (_this.lastAdInsertionPoint && !_this.inAdBreak && !_this.pendingAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3033
+ if (_this.lastAdInsertionPoint && !_this.inAdBreak && _this.lastAdInsertionPoint.updated_at !== _this.processedAdInsertionUpdatedAt) {
3034
3034
  var segmentName = _this.lastAdInsertionPoint.segment_ts_name;
3035
3035
  if (_this.fragmentMatchesSegment(frag, segmentName)) {
3036
- var _ref;
3036
+ var _ref, _ref1;
3037
+ var _this_pendingAdBreak;
3037
3038
  _this.processedAdInsertionUpdatedAt = _this.lastAdInsertionPoint.updated_at;
3038
3039
  var offsetMs = (_this.lastAdInsertionPoint.offset_seconds || 0) * 1e3;
3040
+ var durationSeconds = (_ref = (_this_pendingAdBreak = _this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.durationSeconds) !== null && _ref !== void 0 ? _ref : 60;
3041
+ var withPrefetch = _this.pendingAdBreak != null;
3039
3042
  _this.pushAdInsertionDebug("segment_playing", segmentName, {
3040
3043
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3041
- detail: "sn=".concat((_ref = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref !== void 0 ? _ref : "?")
3044
+ detail: "sn=".concat((_ref1 = frag === null || frag === void 0 ? void 0 : frag.sn) !== null && _ref1 !== void 0 ? _ref1 : "?").concat(withPrefetch ? " (prefetch active)" : "")
3042
3045
  });
3043
3046
  if (_this.config.debugAdTiming) {
3044
- console.log('[StormcloudVideoPlayer] Ad insertion segment "'.concat(segmentName, '" now playing — scheduling ad start in ').concat(offsetMs, "ms"));
3047
+ 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)" : ""));
3045
3048
  }
3046
3049
  _this.pushAdInsertionDebug("ad_scheduled", segmentName, {
3047
3050
  offsetSeconds: _this.lastAdInsertionPoint.offset_seconds,
3048
- detail: "in ".concat(offsetMs, "ms, dur=60s")
3051
+ detail: "in ".concat(offsetMs, "ms, dur=").concat(durationSeconds, "s").concat(withPrefetch ? " (with prefetch)" : "")
3049
3052
  });
3050
3053
  _this.clearAdInsertionOffsetTimer();
3051
3054
  _this.adInsertionOffsetTimerId = window.setTimeout(function() {
3052
3055
  _this.adInsertionOffsetTimerId = void 0;
3053
3056
  if (_this.inAdBreak) return;
3054
3057
  _this.pushAdInsertionDebug("ad_triggered", segmentName, {
3055
- detail: "ad break started (60s)"
3058
+ detail: "ad break started (".concat(durationSeconds, "s").concat(withPrefetch ? ", with prefetch" : "", ")")
3056
3059
  });
3057
- void _this.handleAdStart(60);
3060
+ void _this.handleAdStart(durationSeconds);
3058
3061
  }, offsetMs);
3059
3062
  }
3060
3063
  }
@@ -3922,7 +3925,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3922
3925
  this.pushAdInsertionDebug("api_response", data.segment_ts_name, {
3923
3926
  offsetSeconds: data.offset_seconds,
3924
3927
  updatedAt: data.updated_at,
3925
- detail: "ch=".concat(data.channel_id, " id=").concat(data.id)
3928
+ detail: "ch=".concat(data.channel_id)
3926
3929
  });
3927
3930
  if (segmentChanged && (this.pendingAdBreak || this.adInsertionOffsetTimerId != null)) {
3928
3931
  this.clearAdInsertionOffsetTimer();
@@ -7566,7 +7569,8 @@ var StormcloudVideoPlayerComponent = import_react2.default.memo(function(props)
7566
7569
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
7567
7570
  if (disableAds !== void 0) cfg.disableAds = disableAds;
7568
7571
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
7569
- if (!adcisionChannelId && swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7572
+ if (adcisionChannelId !== void 0) cfg.projectId = String(adcisionChannelId);
7573
+ else if (swirlProjectId !== void 0) cfg.projectId = String(swirlProjectId);
7570
7574
  var player = new StormcloudVideoPlayer(cfg);
7571
7575
  playerRef.current = player;
7572
7576
  player.load().then(function() {