call-live-sdk1 0.0.33 → 0.0.35

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.
@@ -28814,7 +28814,7 @@ function removeSign(options = {}) {
28814
28814
  localStorage.removeItem(storageKey);
28815
28815
  }
28816
28816
  const isMobile$3 = (() => {
28817
- const mobileRegex = /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i;
28817
+ const mobileRegex = /\b(Android|Adr|adr|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS|Kindle|Silk|Windows Phone|Windows Mobile)\b/i;
28818
28818
  const tabletRegex = /iPad/i;
28819
28819
  const userAgent2 = navigator.userAgent;
28820
28820
  const platform2 = navigator.platform;
@@ -28822,6 +28822,10 @@ const isMobile$3 = (() => {
28822
28822
  if (mobileRegex.test(userAgent2)) {
28823
28823
  return true;
28824
28824
  }
28825
+ const isAndroid2 = /(^|\W)(Android|Adr|adr)(\W|$)/i.test(userAgent2) || /\bLinux\b/i.test(userAgent2) && /(\bMobile\b|\bTablet\b|\bAdr\b)/i.test(userAgent2);
28826
+ if (isAndroid2) {
28827
+ return true;
28828
+ }
28825
28829
  if ((platform2 === "MacIntel" || platform2 === "iPad") && isTouchDevice) {
28826
28830
  const screenWidth = window.screen.width;
28827
28831
  const screenHeight = window.screen.height;
@@ -169785,41 +169789,6 @@ function debounce$2(func, wait2, options) {
169785
169789
  debounced.flush = flush3;
169786
169790
  return debounced;
169787
169791
  }
169788
- const CountDown = ({ isLive }) => {
169789
- const [timer, setTimer] = reactExports.useState("00:00:00");
169790
- const timerIntervalRef = reactExports.useRef(null);
169791
- const secondsRef = reactExports.useRef(0);
169792
- const formatTime2 = (totalSeconds) => {
169793
- const hours = Math.floor(totalSeconds / 3600);
169794
- const minutes = Math.floor(totalSeconds % 3600 / 60);
169795
- const seconds = totalSeconds % 60;
169796
- return [hours, minutes, seconds].map((v3) => v3 < 10 ? `0${v3}` : v3).join(":");
169797
- };
169798
- reactExports.useEffect(() => {
169799
- if (isLive) {
169800
- secondsRef.current = 0;
169801
- setTimer("00:00:00");
169802
- timerIntervalRef.current = setInterval(() => {
169803
- secondsRef.current += 1;
169804
- setTimer(formatTime2(secondsRef.current));
169805
- }, 1e3);
169806
- } else {
169807
- if (timerIntervalRef.current) {
169808
- clearInterval(timerIntervalRef.current);
169809
- timerIntervalRef.current = null;
169810
- }
169811
- secondsRef.current = 0;
169812
- setTimer("00:00:00");
169813
- }
169814
- return () => {
169815
- if (timerIntervalRef.current) {
169816
- clearInterval(timerIntervalRef.current);
169817
- }
169818
- };
169819
- }, [isLive]);
169820
- return isLive && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-16px text-#fff h-full flex items-center mr-3", children: timer });
169821
- };
169822
- const CountDown$1 = reactExports.memo(CountDown);
169823
169792
  const useLivePushCodeStore = create$c((set3, get4) => ({
169824
169793
  livePushCode: null,
169825
169794
  isLoading: false,
@@ -169893,6 +169862,41 @@ const useCommentChatUrlStore = create$c((set3) => ({
169893
169862
  }
169894
169863
  }
169895
169864
  }));
169865
+ const CountDown = ({ isLive }) => {
169866
+ const [timer, setTimer] = reactExports.useState("00:00:00");
169867
+ const timerIntervalRef = reactExports.useRef(null);
169868
+ const secondsRef = reactExports.useRef(0);
169869
+ const formatTime2 = (totalSeconds) => {
169870
+ const hours = Math.floor(totalSeconds / 3600);
169871
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
169872
+ const seconds = totalSeconds % 60;
169873
+ return [hours, minutes, seconds].map((v3) => v3 < 10 ? `0${v3}` : v3).join(":");
169874
+ };
169875
+ reactExports.useEffect(() => {
169876
+ if (isLive) {
169877
+ secondsRef.current = 0;
169878
+ setTimer("00:00:00");
169879
+ timerIntervalRef.current = setInterval(() => {
169880
+ secondsRef.current += 1;
169881
+ setTimer(formatTime2(secondsRef.current));
169882
+ }, 1e3);
169883
+ } else {
169884
+ if (timerIntervalRef.current) {
169885
+ clearInterval(timerIntervalRef.current);
169886
+ timerIntervalRef.current = null;
169887
+ }
169888
+ secondsRef.current = 0;
169889
+ setTimer("00:00:00");
169890
+ }
169891
+ return () => {
169892
+ if (timerIntervalRef.current) {
169893
+ clearInterval(timerIntervalRef.current);
169894
+ }
169895
+ };
169896
+ }, [isLive]);
169897
+ return isLive && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-16px text-#fff h-full flex items-center mr-3", children: timer });
169898
+ };
169899
+ const CountDown$1 = reactExports.memo(CountDown);
169896
169900
  const useActivityTypeStore = create$c((set3, get4) => ({
169897
169901
  activityType: {
169898
169902
  active_type: 0
@@ -186061,7 +186065,7 @@ class WTNStream extends EnhancedEventEmitter {
186061
186065
  }
186062
186066
  }
186063
186067
  __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "startPushWTN"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "stopPushWTN"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "muteWTNLocalAudio"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "muteWTNLocalVideo"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "sendWTNSEIMessage"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "startPlayWTN"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "stopPlayWTN"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "muteWTNRemoteAudio"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "muteWTNRemoteVideo"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "setWTNRemoteVideoPlayer"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "setWTNRemoteAudioPlaybackVolume"), __decorateClass$2([reportRtcSdkApi()], WTNStream.prototype, "getWTNVideoPlayerVisibility"), __decorateClass$2([pubSubLock], WTNStream.prototype, "_sendStartPushStreamSignal"), __decorateClass$2([pubSubLock], WTNStream.prototype, "_stopLocalStream"), __decorateClass$2([pubSubLock], WTNStream.prototype, "_sendStartPullStreamSignal"), __decorateClass$2([pubSubLock], WTNStream.prototype, "_unsubscribePublicStream");
186064
- const logger$1 = new Logger$1$1("AudioDeviceManager", 1);
186068
+ const logger$1$1 = new Logger$1$1("AudioDeviceManager", 1);
186065
186069
  class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186066
186070
  constructor(e3) {
186067
186071
  super(), _defineProperty$a(this, "_audioLevelFetcher", void 0), _defineProperty$a(this, "_playbackDeviceTestTimer", void 0), _defineProperty$a(this, "_audioElement", void 0), _defineProperty$a(this, "_audioTrack", void 0), _defineProperty$a(this, "_mediaRecorder", void 0), _defineProperty$a(this, "_recoderTimer", void 0), _defineProperty$a(this, "_isAudioPlaybackDeviceTesting", false), _defineProperty$a(this, "_isAudioDeviceRecordTesting", false), _defineProperty$a(this, "_audioCaptureAndRecoderResolve", void 0), _defineProperty$a(this, "_onAutoplayFailed", void 0), _defineProperty$a(this, "_audioPlaybackDeviceId", void 0), this._ctx = e3;
@@ -186072,16 +186076,16 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186072
186076
  async startAudioPlaybackDeviceTest(e3, t2) {
186073
186077
  if (this._isAudioPlaybackDeviceTesting || this._isAudioDeviceRecordTesting)
186074
186078
  throw new SDKError(ErrorCode.REPEAT_DEVICE_TEST, "device test cannot be called repeatedly at the same time.");
186075
- this._isAudioPlaybackDeviceTesting = true, logger$1.info("startAudioPlaybackDeviceTest()", "Invoke");
186079
+ this._isAudioPlaybackDeviceTesting = true, logger$1$1.info("startAudioPlaybackDeviceTest()", "Invoke");
186076
186080
  try {
186077
186081
  await this._playAudioFile(e3, { loop: true });
186078
186082
  } catch (e4) {
186079
- throw logger$1.error("startAudioPlaybackDeviceTest()", "error", e4), this.stopAudioPlaybackDeviceTest(), e4;
186083
+ throw logger$1$1.error("startAudioPlaybackDeviceTest()", "error", e4), this.stopAudioPlaybackDeviceTest(), e4;
186080
186084
  }
186081
186085
  this._startEmitAudioPlaybackDeviceTestVolume(t2);
186082
186086
  }
186083
186087
  stopAudioPlaybackDeviceTest() {
186084
- this._isAudioPlaybackDeviceTesting && (logger$1.info("stopAudioPlaybackDeviceTest()", "Invoke"), this._isAudioPlaybackDeviceTesting = false, this._stopEmitAudioPlaybackDeviceTestVolume(), this._destroyAudioElement());
186088
+ this._isAudioPlaybackDeviceTesting && (logger$1$1.info("stopAudioPlaybackDeviceTest()", "Invoke"), this._isAudioPlaybackDeviceTesting = false, this._stopEmitAudioPlaybackDeviceTestVolume(), this._destroyAudioElement());
186085
186089
  }
186086
186090
  async startAudioDeviceRecordTest(e3, t2, i) {
186087
186091
  let o2 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 3e4;
@@ -186089,8 +186093,8 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186089
186093
  throw new SDKError(ErrorCode.NOT_SUPPORTED, "Your browser does not support MediaRecorder.");
186090
186094
  if (this._isAudioDeviceRecordTesting || this._isAudioPlaybackDeviceTesting)
186091
186095
  throw new SDKError(ErrorCode.REPEAT_DEVICE_TEST, "device test cannot be called repeatedly at the same time.");
186092
- this._isAudioDeviceRecordTesting = true, logger$1.info("startAudioDeviceRecordTest()", "Invoke"), this._recoderTimer = setTimeout(() => {
186093
- logger$1.info("startAudioDeviceRecordTest()", "".concat(o2, 'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')), this._stopAudioCaptureAndRecoder();
186096
+ this._isAudioDeviceRecordTesting = true, logger$1$1.info("startAudioDeviceRecordTest()", "Invoke"), this._recoderTimer = setTimeout(() => {
186097
+ logger$1$1.info("startAudioDeviceRecordTest()", "".concat(o2, 'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')), this._stopAudioCaptureAndRecoder();
186094
186098
  }, o2);
186095
186099
  try {
186096
186100
  this._onAutoplayFailed = t2, await this._startAudioCaptureAndRecoder(e3, null != i ? i : 100);
@@ -186100,16 +186104,16 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186100
186104
  delete this._audioCaptureAndRecoderResolve;
186101
186105
  }
186102
186106
  stopAudioDeviceRecordAndPlayTest() {
186103
- logger$1.info("stopAudioDeviceRecordAndPlayTest()", "Invoke"), void 0 !== this._recoderTimer && (clearTimeout(this._recoderTimer), delete this._recoderTimer), this._stopAudioCaptureAndRecoder();
186107
+ logger$1$1.info("stopAudioDeviceRecordAndPlayTest()", "Invoke"), void 0 !== this._recoderTimer && (clearTimeout(this._recoderTimer), delete this._recoderTimer), this._stopAudioCaptureAndRecoder();
186104
186108
  }
186105
186109
  stopAudioDevicePlayTest() {
186106
- this._isAudioDeviceRecordTesting && (logger$1.info("stopAudioDevicePlayTest()", "Invoke"), this._isAudioDeviceRecordTesting = false, this._mediaRecorder && (this._mediaRecorder.ondataavailable = null), this.stopAudioDeviceRecordAndPlayTest(), this._stopEmitAudioPlaybackDeviceTestVolume(), this._destroyAudioElement()), delete this._onAutoplayFailed;
186110
+ this._isAudioDeviceRecordTesting && (logger$1$1.info("stopAudioDevicePlayTest()", "Invoke"), this._isAudioDeviceRecordTesting = false, this._mediaRecorder && (this._mediaRecorder.ondataavailable = null), this.stopAudioDeviceRecordAndPlayTest(), this._stopEmitAudioPlaybackDeviceTestVolume(), this._destroyAudioElement()), delete this._onAutoplayFailed;
186107
186111
  }
186108
186112
  getRecordTrack() {
186109
186113
  return this._audioTrack;
186110
186114
  }
186111
186115
  async setSinkId(e3) {
186112
- if (logger$1.info("setSinkId()", "Invoke"), void 0 === HTMLAudioElement.prototype.setSinkId)
186116
+ if (logger$1$1.info("setSinkId()", "Invoke"), void 0 === HTMLAudioElement.prototype.setSinkId)
186113
186117
  throw new SDKError(ErrorCode.NOT_SUPPORTED, "setSinkId not supported by current browser");
186114
186118
  const t2 = await dd.getAudioPlaybackDeviceById(e3);
186115
186119
  if (!t2)
@@ -186120,22 +186124,22 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186120
186124
  return this._audioPlaybackDeviceId;
186121
186125
  }
186122
186126
  destroy() {
186123
- logger$1.info("destroy()", "Invoke"), super.removeAllListeners(), this.stopAudioPlaybackDeviceTest(), this.stopAudioDevicePlayTest();
186127
+ logger$1$1.info("destroy()", "Invoke"), super.removeAllListeners(), this.stopAudioPlaybackDeviceTest(), this.stopAudioDevicePlayTest();
186124
186128
  }
186125
186129
  async _playAudioFile(e3, t2) {
186126
- return logger$1.info("_playAudioFile()", "Invoke url=".concat(e3, "; loop=").concat(t2.loop)), new Promise((i, o2) => {
186130
+ return logger$1$1.info("_playAudioFile()", "Invoke url=".concat(e3, "; loop=").concat(t2.loop)), new Promise((i, o2) => {
186127
186131
  const r3 = createElement$3("audio", { attributes: { src: e3, crossOrigin: "anonymous" } });
186128
186132
  this._audioElement = r3, r3.loop = t2.loop, this._audioLevelFetcher = new AudioLevelFetcher(r3), r3.onplaying = () => {
186129
- r3.onplaying = null, logger$1.info("_playAudioFile()", "onplaying"), i();
186133
+ r3.onplaying = null, logger$1$1.info("_playAudioFile()", "onplaying"), i();
186130
186134
  }, r3.onerror = async (e4) => {
186131
186135
  var t3;
186132
- logger$1.error("_playAudioFile()", "onerror", e4);
186136
+ logger$1$1.error("_playAudioFile()", "onerror", e4);
186133
186137
  const i2 = e4.message || (null == r3 || null === (t3 = r3.error) || void 0 === t3 ? void 0 : t3.message);
186134
186138
  o2(new SDKError(ErrorCode.LOAD_RESOURCES_FAILED, "Failed to play recorded audio".concat(i2 ? ", reason: ".concat(i2) : ".")));
186135
186139
  }, this._setAudioCtxSinkId().then(() => {
186136
186140
  var e4, t3;
186137
186141
  return null === (e4 = r3.play()) || void 0 === e4 || null === (t3 = e4.catch) || void 0 === t3 ? void 0 : t3.call(e4, (e5) => {
186138
- logger$1.warn("_playAudioFile()", "autoplay error", e5);
186142
+ logger$1$1.warn("_playAudioFile()", "autoplay error", e5);
186139
186143
  const t4 = "Failed to play recorded audio, ".concat(e5.name, ": ").concat(e5.message);
186140
186144
  "NotAllowedError" === e5.name && this._onAutoplayFailed ? this._onAutoplayFailed(() => {
186141
186145
  var e6;
@@ -186146,28 +186150,28 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186146
186150
  });
186147
186151
  }
186148
186152
  _destroyAudioElement() {
186149
- this._audioElement && (logger$1.info("_destroyAudioElement()", "Invoke"), this._audioElement.onplaying = null, this._audioElement.onerror = null, this._audioElement.src = "", delete this._audioElement, "function" == typeof this._audioCaptureAndRecoderResolve && this._audioCaptureAndRecoderResolve());
186153
+ this._audioElement && (logger$1$1.info("_destroyAudioElement()", "Invoke"), this._audioElement.onplaying = null, this._audioElement.onerror = null, this._audioElement.src = "", delete this._audioElement, "function" == typeof this._audioCaptureAndRecoderResolve && this._audioCaptureAndRecoderResolve());
186150
186154
  }
186151
186155
  _startEmitAudioPlaybackDeviceTestVolume(e3) {
186152
- e3 = Math.max(e3, 100), this._audioElement && (logger$1.info("_startEmitAudioPlaybackDeviceTestVolume()", "start timer(".concat(e3, "ms)")), this._playbackDeviceTestTimer = self.setInterval(() => {
186156
+ e3 = Math.max(e3, 100), this._audioElement && (logger$1$1.info("_startEmitAudioPlaybackDeviceTestVolume()", "start timer(".concat(e3, "ms)")), this._playbackDeviceTestTimer = self.setInterval(() => {
186153
186157
  this._audioLevelFetcher && this.emit("onAudioPlaybackDeviceTestVolume", this._audioLevelFetcher.getAudioLevel());
186154
186158
  }, e3));
186155
186159
  }
186156
186160
  _stopEmitAudioPlaybackDeviceTestVolume() {
186157
186161
  var e3;
186158
- void 0 !== this._playbackDeviceTestTimer && (logger$1.info("_stopEmitAudioPlaybackDeviceTestVolume()", "stop timer"), self.clearInterval(this._playbackDeviceTestTimer), delete this._playbackDeviceTestTimer), null === (e3 = this._audioLevelFetcher) || void 0 === e3 || e3.destroy(), delete this._audioLevelFetcher;
186162
+ void 0 !== this._playbackDeviceTestTimer && (logger$1$1.info("_stopEmitAudioPlaybackDeviceTestVolume()", "stop timer"), self.clearInterval(this._playbackDeviceTestTimer), delete this._playbackDeviceTestTimer), null === (e3 = this._audioLevelFetcher) || void 0 === e3 || e3.destroy(), delete this._audioLevelFetcher;
186159
186163
  }
186160
186164
  async _startAudioCaptureAndRecoder(e3, t2) {
186161
186165
  this._audioTrack = await createMicrophoneAudioTrack(this._ctx, this._ctx.audioProfileManager.getConstraints()), this._audioTrack.setVolume(t2 + 0.01);
186162
186166
  const i = new MediaStream([this._audioTrack.preprocessingTrack]);
186163
- return logger$1.info("startAudioDeviceRecordTest()", "create microphone track success!"), new Promise((t3, o2) => {
186167
+ return logger$1$1.info("startAudioDeviceRecordTest()", "create microphone track success!"), new Promise((t3, o2) => {
186164
186168
  let r3;
186165
- "function" == typeof MediaRecorder.isTypeSupported && (r3 = ["audio/webm", "audio/mp4"].find((e4) => MediaRecorder.isTypeSupported(e4)), logger$1.info("startAudioDeviceRecordTest()", "use mimeType: ".concat(r3))), this._mediaRecorder = new MediaRecorder(i, r3 ? { mimeType: r3 } : void 0);
186169
+ "function" == typeof MediaRecorder.isTypeSupported && (r3 = ["audio/webm", "audio/mp4"].find((e4) => MediaRecorder.isTypeSupported(e4)), logger$1$1.info("startAudioDeviceRecordTest()", "use mimeType: ".concat(r3))), this._mediaRecorder = new MediaRecorder(i, r3 ? { mimeType: r3 } : void 0);
186166
186170
  const s3 = this._mediaRecorder.mimeType;
186167
186171
  this._mediaRecorder.ondataavailable = async (i2) => {
186168
186172
  if (this._isAudioDeviceRecordTesting) {
186169
186173
  var r4;
186170
- logger$1.info("startAudioDeviceRecordTest()", "get recorded file(mimeType: ".concat(s3, ")."));
186174
+ logger$1$1.info("startAudioDeviceRecordTest()", "get recorded file(mimeType: ".concat(s3, ")."));
186171
186175
  const n3 = new Blob([i2.data], { type: s3 });
186172
186176
  try {
186173
186177
  await this._playAudioFile(_URL.createObjectURL(n3), { loop: false });
@@ -186194,9 +186198,9 @@ class AudioDeviceManager extends eventemitter3Exports$1.EventEmitter {
186194
186198
  "default" === e3 && (e3 = "");
186195
186199
  try {
186196
186200
  var t2, i;
186197
- null === (t2 = audioContextManager.getAudioContextInstance()) || void 0 === t2 || null === (i = t2.setSinkId) || void 0 === i || i.call(t2, e3), logger$1.info("setSinkId", "ctx.sinkId=".concat(e3));
186201
+ null === (t2 = audioContextManager.getAudioContextInstance()) || void 0 === t2 || null === (i = t2.setSinkId) || void 0 === i || i.call(t2, e3), logger$1$1.info("setSinkId", "ctx.sinkId=".concat(e3));
186198
186202
  } catch (e4) {
186199
- logger$1.error("setSinkId", "failed, ".concat(e4.name, " - ").concat(e4.message));
186203
+ logger$1$1.error("setSinkId", "failed, ".concat(e4.name, " - ").concat(e4.message));
186200
186204
  }
186201
186205
  }
186202
186206
  }
@@ -211308,6 +211312,73 @@ class bh extends Va {
211308
211312
  }
211309
211313
  }
211310
211314
  t(bh, "type", "Vibrance"), t(bh, "defaults", { vibrance: 0 }), t(bh, "uniformLocations", ["uVibrance"]), tt.setClass(bh);
211315
+ const useCallUserPagination = (config2) => {
211316
+ const { gridCols } = config2;
211317
+ const [currentPage, setCurrentPage] = reactExports.useState(1);
211318
+ const { callUsers, setCallUsersCurrentPageRef, layoutMode } = useCallStore();
211319
+ reactExports.useEffect(() => {
211320
+ setCallUsersCurrentPageRef(currentPage);
211321
+ }, [currentPage]);
211322
+ reactExports.useEffect(() => {
211323
+ setCurrentPage(1);
211324
+ }, [layoutMode]);
211325
+ const usersPerPage = reactExports.useMemo(() => {
211326
+ return gridCols <= 1 ? 5 : 9;
211327
+ }, [gridCols]);
211328
+ const getTotalVideoCount = reactExports.useMemo(() => {
211329
+ const videoList = callUsers.flatMap((item) => {
211330
+ var _a2, _b, _c2;
211331
+ if (item.waiting_mode_state === WaitingModeState.WAITING) {
211332
+ return [];
211333
+ }
211334
+ if (item.isScreenEnabled) {
211335
+ return [(_a2 = item.videoList) == null ? void 0 : _a2[1], (_b = item.videoList) == null ? void 0 : _b[0]];
211336
+ }
211337
+ return [(_c2 = item.videoList) == null ? void 0 : _c2[0]];
211338
+ });
211339
+ return videoList.length;
211340
+ }, [callUsers]);
211341
+ reactExports.useEffect(() => {
211342
+ if (gridCols <= 1 && getTotalVideoCount <= 5) {
211343
+ setCurrentPage(1);
211344
+ }
211345
+ }, [gridCols, getTotalVideoCount]);
211346
+ const getTotalPages = reactExports.useMemo(() => {
211347
+ return Math.ceil(getTotalVideoCount / usersPerPage) || 1;
211348
+ }, [getTotalVideoCount, usersPerPage]);
211349
+ const calculateOptimalGridCols = (userCount, defaultGridCols) => {
211350
+ if (defaultGridCols <= 1)
211351
+ return defaultGridCols;
211352
+ if (userCount <= 1)
211353
+ return 1;
211354
+ if (userCount === 2)
211355
+ return 2;
211356
+ if (userCount <= 4)
211357
+ return 2;
211358
+ if (userCount <= 9)
211359
+ return 3;
211360
+ return 3;
211361
+ };
211362
+ const handlePrevPage = () => {
211363
+ setCurrentPage((prev2) => Math.max(prev2 - 1, 1));
211364
+ };
211365
+ const handleNextPage = () => {
211366
+ setCurrentPage((prev2) => Math.min(prev2 + 1, getTotalPages));
211367
+ };
211368
+ const goToPage = (pageNumber) => {
211369
+ setCurrentPage(Math.min(Math.max(pageNumber, 1), getTotalPages));
211370
+ };
211371
+ return {
211372
+ currentPage,
211373
+ usersPerPage,
211374
+ totalPages: getTotalPages,
211375
+ totalVideoCount: getTotalVideoCount,
211376
+ handlePrevPage,
211377
+ handleNextPage,
211378
+ goToPage,
211379
+ calculateOptimalGridCols
211380
+ };
211381
+ };
211311
211382
  function _extends$y() {
211312
211383
  _extends$y = Object.assign ? Object.assign.bind() : function(target) {
211313
211384
  for (var i = 1; i < arguments.length; i++) {
@@ -211780,73 +211851,6 @@ const CallSingleColumnLayout = ({
211780
211851
  })]
211781
211852
  });
211782
211853
  };
211783
- const useCallUserPagination = (config2) => {
211784
- const { gridCols } = config2;
211785
- const [currentPage, setCurrentPage] = reactExports.useState(1);
211786
- const { callUsers, setCallUsersCurrentPageRef, layoutMode } = useCallStore();
211787
- reactExports.useEffect(() => {
211788
- setCallUsersCurrentPageRef(currentPage);
211789
- }, [currentPage]);
211790
- reactExports.useEffect(() => {
211791
- setCurrentPage(1);
211792
- }, [layoutMode]);
211793
- const usersPerPage = reactExports.useMemo(() => {
211794
- return gridCols <= 1 ? 5 : 9;
211795
- }, [gridCols]);
211796
- const getTotalVideoCount = reactExports.useMemo(() => {
211797
- const videoList = callUsers.flatMap((item) => {
211798
- var _a2, _b, _c2;
211799
- if (item.waiting_mode_state === WaitingModeState.WAITING) {
211800
- return [];
211801
- }
211802
- if (item.isScreenEnabled) {
211803
- return [(_a2 = item.videoList) == null ? void 0 : _a2[1], (_b = item.videoList) == null ? void 0 : _b[0]];
211804
- }
211805
- return [(_c2 = item.videoList) == null ? void 0 : _c2[0]];
211806
- });
211807
- return videoList.length;
211808
- }, [callUsers]);
211809
- reactExports.useEffect(() => {
211810
- if (gridCols <= 1 && getTotalVideoCount <= 5) {
211811
- setCurrentPage(1);
211812
- }
211813
- }, [gridCols, getTotalVideoCount]);
211814
- const getTotalPages = reactExports.useMemo(() => {
211815
- return Math.ceil(getTotalVideoCount / usersPerPage) || 1;
211816
- }, [getTotalVideoCount, usersPerPage]);
211817
- const calculateOptimalGridCols = (userCount, defaultGridCols) => {
211818
- if (defaultGridCols <= 1)
211819
- return defaultGridCols;
211820
- if (userCount <= 1)
211821
- return 1;
211822
- if (userCount === 2)
211823
- return 2;
211824
- if (userCount <= 4)
211825
- return 2;
211826
- if (userCount <= 9)
211827
- return 3;
211828
- return 3;
211829
- };
211830
- const handlePrevPage = () => {
211831
- setCurrentPage((prev2) => Math.max(prev2 - 1, 1));
211832
- };
211833
- const handleNextPage = () => {
211834
- setCurrentPage((prev2) => Math.min(prev2 + 1, getTotalPages));
211835
- };
211836
- const goToPage = (pageNumber) => {
211837
- setCurrentPage(Math.min(Math.max(pageNumber, 1), getTotalPages));
211838
- };
211839
- return {
211840
- currentPage,
211841
- usersPerPage,
211842
- totalPages: getTotalPages,
211843
- totalVideoCount: getTotalVideoCount,
211844
- handlePrevPage,
211845
- handleNextPage,
211846
- goToPage,
211847
- calculateOptimalGridCols
211848
- };
211849
- };
211850
211854
  const useOnlineUsers = () => {
211851
211855
  const { callUsers, callConfig } = useCallStore();
211852
211856
  const [isLoading, setIsLoading] = reactExports.useState(false);
@@ -270450,6 +270454,87 @@ const SvgGuideO = reactExports.forwardRef((props, ref) => {
270450
270454
  reactExports.createElement(SvgIcon$6, null)
270451
270455
  );
270452
270456
  });
270457
+ const useDrawingToolsStore = create$c((set3, get4) => ({
270458
+ // 选中的工具
270459
+ selectedTool: 0,
270460
+ setSelectedTool: (tool) => set3({ selectedTool: tool }),
270461
+ // 画笔设置
270462
+ penSize: 2,
270463
+ setPenSize: (size) => set3((state) => {
270464
+ const newSize = typeof size === "function" ? size(state.penSize) : size;
270465
+ return {
270466
+ penSize: newSize
270467
+ };
270468
+ }),
270469
+ penColor: "#ff5a5a",
270470
+ setPenColor: (color) => set3((state) => {
270471
+ const newColor = typeof color === "function" ? color(state.penColor) : color;
270472
+ return {
270473
+ penColor: newColor
270474
+ };
270475
+ }),
270476
+ // 激光笔设置
270477
+ laserPenSize: 2,
270478
+ setLaserPenSize: (size) => set3((state) => {
270479
+ const newSize = typeof size === "function" ? size(state.laserPenSize) : size;
270480
+ return {
270481
+ laserPenSize: newSize
270482
+ };
270483
+ }),
270484
+ laserPenColor: "#ff5a5a",
270485
+ setLaserPenColor: (color) => set3((state) => {
270486
+ const newColor = typeof color === "function" ? color(state.laserPenColor) : color;
270487
+ return {
270488
+ laserPenColor: newColor
270489
+ };
270490
+ }),
270491
+ // 形状设置
270492
+ shapeSize: 2,
270493
+ setShapeSize: (size) => set3((state) => {
270494
+ const newSize = typeof size === "function" ? size(state.shapeSize) : size;
270495
+ return {
270496
+ shapeSize: newSize
270497
+ };
270498
+ }),
270499
+ shapeType: "rect",
270500
+ setShapeType: (type4) => set3((state) => {
270501
+ const newType = typeof type4 === "function" ? type4(state.shapeType) : type4;
270502
+ return {
270503
+ shapeType: newType,
270504
+ shapeTypeRef: { current: newType }
270505
+ };
270506
+ }),
270507
+ shapeColor: "#ff5a5a",
270508
+ setShapeColor: (color) => set3((state) => {
270509
+ const newColor = typeof color === "function" ? color(state.shapeColor) : color;
270510
+ return {
270511
+ shapeColor: newColor
270512
+ };
270513
+ }),
270514
+ // 文字设置
270515
+ textSize: 16,
270516
+ setTextSize: (size) => set3((state) => {
270517
+ const newSize = typeof size === "function" ? size(state.textSize) : size;
270518
+ return {
270519
+ textSize: newSize
270520
+ };
270521
+ }),
270522
+ textColor: "#ff5a5a",
270523
+ setTextColor: (color) => set3((state) => {
270524
+ const newColor = typeof color === "function" ? color(state.textColor) : color;
270525
+ return {
270526
+ textColor: newColor
270527
+ };
270528
+ }),
270529
+ // 预览弹窗状态
270530
+ isPreviewModalVisible: false,
270531
+ setIsPreviewModalVisible: (visible) => set3({ isPreviewModalVisible: visible }),
270532
+ // 绘图相关引用
270533
+ downPoint: { current: null },
270534
+ upPoint: { current: null },
270535
+ currentShape: { current: null },
270536
+ getter: () => get4()
270537
+ }));
270453
270538
  const ShapeTypePicker = reactExports.memo(
270454
270539
  ({
270455
270540
  types: types2 = ["rect", "circle"],
@@ -270597,87 +270682,6 @@ const ToolOption = reactExports.memo(({
270597
270682
  });
270598
270683
  });
270599
270684
  ToolOption.displayName = "ToolOption";
270600
- const useDrawingToolsStore = create$c((set3, get4) => ({
270601
- // 选中的工具
270602
- selectedTool: 0,
270603
- setSelectedTool: (tool) => set3({ selectedTool: tool }),
270604
- // 画笔设置
270605
- penSize: 2,
270606
- setPenSize: (size) => set3((state) => {
270607
- const newSize = typeof size === "function" ? size(state.penSize) : size;
270608
- return {
270609
- penSize: newSize
270610
- };
270611
- }),
270612
- penColor: "#ff5a5a",
270613
- setPenColor: (color) => set3((state) => {
270614
- const newColor = typeof color === "function" ? color(state.penColor) : color;
270615
- return {
270616
- penColor: newColor
270617
- };
270618
- }),
270619
- // 激光笔设置
270620
- laserPenSize: 2,
270621
- setLaserPenSize: (size) => set3((state) => {
270622
- const newSize = typeof size === "function" ? size(state.laserPenSize) : size;
270623
- return {
270624
- laserPenSize: newSize
270625
- };
270626
- }),
270627
- laserPenColor: "#ff5a5a",
270628
- setLaserPenColor: (color) => set3((state) => {
270629
- const newColor = typeof color === "function" ? color(state.laserPenColor) : color;
270630
- return {
270631
- laserPenColor: newColor
270632
- };
270633
- }),
270634
- // 形状设置
270635
- shapeSize: 2,
270636
- setShapeSize: (size) => set3((state) => {
270637
- const newSize = typeof size === "function" ? size(state.shapeSize) : size;
270638
- return {
270639
- shapeSize: newSize
270640
- };
270641
- }),
270642
- shapeType: "rect",
270643
- setShapeType: (type4) => set3((state) => {
270644
- const newType = typeof type4 === "function" ? type4(state.shapeType) : type4;
270645
- return {
270646
- shapeType: newType,
270647
- shapeTypeRef: { current: newType }
270648
- };
270649
- }),
270650
- shapeColor: "#ff5a5a",
270651
- setShapeColor: (color) => set3((state) => {
270652
- const newColor = typeof color === "function" ? color(state.shapeColor) : color;
270653
- return {
270654
- shapeColor: newColor
270655
- };
270656
- }),
270657
- // 文字设置
270658
- textSize: 16,
270659
- setTextSize: (size) => set3((state) => {
270660
- const newSize = typeof size === "function" ? size(state.textSize) : size;
270661
- return {
270662
- textSize: newSize
270663
- };
270664
- }),
270665
- textColor: "#ff5a5a",
270666
- setTextColor: (color) => set3((state) => {
270667
- const newColor = typeof color === "function" ? color(state.textColor) : color;
270668
- return {
270669
- textColor: newColor
270670
- };
270671
- }),
270672
- // 预览弹窗状态
270673
- isPreviewModalVisible: false,
270674
- setIsPreviewModalVisible: (visible) => set3({ isPreviewModalVisible: visible }),
270675
- // 绘图相关引用
270676
- downPoint: { current: null },
270677
- upPoint: { current: null },
270678
- currentShape: { current: null },
270679
- getter: () => get4()
270680
- }));
270681
270685
  const COLORS = ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"];
270682
270686
  const LINE_SIZES = [2, 4, 6];
270683
270687
  const TEXT_SIZES = [16, 20, 24, 28, 32];
@@ -279082,7 +279086,7 @@ var __defProp$1 = _Object$defineProperty, __getOwnPropDesc = _Object$getOwnPrope
279082
279086
  for (var o2, a7 = __getOwnPropDesc(t2, r3), i = e3.length - 1; i >= 0; i--)
279083
279087
  (o2 = e3[i]) && (a7 = o2(t2, r3, a7) || a7);
279084
279088
  return a7 && __defProp$1(t2, r3, a7), a7;
279085
- }, logger = new Logger3("RTCBeautyExtension", 1);
279089
+ }, logger$1 = new Logger3("RTCBeautyExtension", 1);
279086
279090
  function getBrowser() {
279087
279091
  var e3 = "none";
279088
279092
  return null !== window.navigator.userAgent.match("Firefox") ? e3 = "mozilla" : null !== window.navigator.userAgent.match("Chrome") ? (e3 = "chrome-stable", null !== window.navigator.userAgent.match("Electron") && (e3 = "electron")) : (null !== window.navigator.userAgent.match("Safari") || null !== window.navigator.userAgent.match("AppleWebKit")) && (e3 = "safari"), e3;
@@ -279464,7 +279468,7 @@ var _RTCBeautyExtension2 = (_Class = function() {
279464
279468
  var t3 = e6.ARSDK;
279465
279469
  _RTCBeautyExtension2.WebARMainSDK = t3;
279466
279470
  }).catch(function(e6) {
279467
- throw logger.error("load ar sdk error", e6), new Error(TIME_OUT_MESSAGE);
279471
+ throw logger$1.error("load ar sdk error", e6), new Error(TIME_OUT_MESSAGE);
279468
279472
  }));
279469
279473
  case 1:
279470
279474
  case "end":
@@ -290682,20 +290686,25 @@ const WaitingUserList = ({
290682
290686
  waitingUsers
290683
290687
  }) => {
290684
290688
  const {
290685
- callUsers,
290689
+ updateCallUser,
290686
290690
  getter,
290687
290691
  kickRoomUser
290688
290692
  } = useCallStore();
290689
290693
  const handleAdmitUser = (userId) => {
290690
290694
  var _a2;
290695
+ updateCallUser(userId, {
290696
+ waiting_mode_state: WaitingModeState.ADMITTED
290697
+ });
290698
+ const latestCallUsers = getter().callUsers;
290691
290699
  (_a2 = getter().rtc) == null ? void 0 : _a2.engine.sendRoomMessage(JSON.stringify({
290692
290700
  type: "waiting_mode",
290693
290701
  data: {
290694
290702
  rtc_userid: userId,
290695
290703
  waiting_mode_state: WaitingModeState.ADMITTED,
290696
- users: callUsers.map((user) => ({
290704
+ users: latestCallUsers.map((user) => ({
290697
290705
  rtc_userid: user.rtc_userid,
290698
- waiting_mode_state: user.waiting_mode_state
290706
+ // 如果是当前准入的用户,使用最新的 ADMITTED 状态
290707
+ waiting_mode_state: user.rtc_userid === userId ? WaitingModeState.ADMITTED : user.waiting_mode_state
290699
290708
  }))
290700
290709
  }
290701
290710
  }));
@@ -301811,9 +301820,17 @@ const useRoomMessageHandler = (params = {}) => {
301811
301820
  console.log("处理用户变更消息", {
301812
301821
  user,
301813
301822
  users,
301814
- action
301823
+ action,
301824
+ senderId: userid
301815
301825
  });
301816
301826
  try {
301827
+ if (action === "confirm" && (user == null ? void 0 : user.waiting_mode_state) === WaitingModeState.ADMITTED) {
301828
+ console.log(`[准入确认] 用户 ${userid} 确认准入`);
301829
+ updateCallUser(userid, {
301830
+ waiting_mode_state: WaitingModeState.ADMITTED
301831
+ });
301832
+ return;
301833
+ }
301817
301834
  if (user) {
301818
301835
  updateCallUser(userid, {
301819
301836
  ...user
@@ -301846,7 +301863,7 @@ const useRoomMessageHandler = (params = {}) => {
301846
301863
  userid
301847
301864
  });
301848
301865
  }
301849
- }, [updateCallUser]);
301866
+ }, [updateCallUser, callConfig.rtc_userid]);
301850
301867
  const handleChangeMediaMessage = reactExports.useCallback((data2, userid) => {
301851
301868
  var _a2;
301852
301869
  const mediaData = data2.data;
@@ -303898,8 +303915,10 @@ const WebLiveLogin = () => {
303898
303915
  };
303899
303916
  }, [handleLogin]);
303900
303917
  reactExports.useEffect(() => {
303901
- window.log = [];
303902
- });
303918
+ if (!window.log) {
303919
+ window.log = [];
303920
+ }
303921
+ }, []);
303903
303922
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
303904
303923
  className: "web-live-login-container",
303905
303924
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -304975,6 +304994,286 @@ const PageIndicator = reactExports.memo(
304975
304994
  }
304976
304995
  );
304977
304996
  PageIndicator.displayName = "PageIndicator";
304997
+ const DEFAULT_CONFIG = {
304998
+ enabled: false,
304999
+ // 开发环境默认启用
305000
+ maxSize: 1e3,
305001
+ cleanupThreshold: 1200,
305002
+ retainSize: 800,
305003
+ autoCleanupInterval: 6e4,
305004
+ // 60秒
305005
+ logToConsole: true,
305006
+ levelFilter: "debug"
305007
+ /* DEBUG */
305008
+ };
305009
+ class LoggerManager {
305010
+ constructor(config2 = {}) {
305011
+ this.cleanupIntervalId = null;
305012
+ this.config = { ...DEFAULT_CONFIG, ...config2 };
305013
+ this.initialize();
305014
+ }
305015
+ /**
305016
+ * 初始化日志管理器
305017
+ */
305018
+ initialize() {
305019
+ if (!window.log) {
305020
+ window.log = [];
305021
+ }
305022
+ if (this.config.autoCleanupInterval && this.config.autoCleanupInterval > 0) {
305023
+ this.startAutoCleanup();
305024
+ }
305025
+ }
305026
+ /**
305027
+ * 开始自动清理
305028
+ */
305029
+ startAutoCleanup() {
305030
+ if (this.cleanupIntervalId) {
305031
+ clearInterval(this.cleanupIntervalId);
305032
+ }
305033
+ this.cleanupIntervalId = setInterval(() => {
305034
+ this.performCleanup();
305035
+ }, this.config.autoCleanupInterval);
305036
+ }
305037
+ /**
305038
+ * 执行日志清理
305039
+ */
305040
+ performCleanup() {
305041
+ const cleaned = this.cleanupLogs(this.config.retainSize);
305042
+ if (cleaned > 0 && this.config.logToConsole) {
305043
+ console.log(`[Logger] 自动清理了 ${cleaned} 条旧日志,保留 ${this.config.retainSize} 条`);
305044
+ }
305045
+ }
305046
+ /**
305047
+ * 检查是否应该记录此级别日志
305048
+ */
305049
+ shouldLog(level) {
305050
+ if (!this.config.enabled)
305051
+ return false;
305052
+ if (!this.config.levelFilter)
305053
+ return true;
305054
+ const levelOrder = {
305055
+ [
305056
+ "debug"
305057
+ /* DEBUG */
305058
+ ]: 0,
305059
+ [
305060
+ "info"
305061
+ /* INFO */
305062
+ ]: 1,
305063
+ [
305064
+ "warn"
305065
+ /* WARN */
305066
+ ]: 2,
305067
+ [
305068
+ "error"
305069
+ /* ERROR */
305070
+ ]: 3,
305071
+ [
305072
+ "critical"
305073
+ /* CRITICAL */
305074
+ ]: 4
305075
+ };
305076
+ return levelOrder[level] >= levelOrder[this.config.levelFilter];
305077
+ }
305078
+ /**
305079
+ * 核心日志记录方法
305080
+ */
305081
+ logInternal(data2) {
305082
+ if (!this.shouldLog(
305083
+ data2.level || "info"
305084
+ /* INFO */
305085
+ ))
305086
+ return;
305087
+ if (!window.log) {
305088
+ window.log = [];
305089
+ }
305090
+ const logEntry = {
305091
+ timestamp: Date.now(),
305092
+ level: data2.level || "info",
305093
+ ...data2
305094
+ };
305095
+ window.log.push(logEntry);
305096
+ if (window.log.length > this.config.cleanupThreshold) {
305097
+ const beforeLength = window.log.length;
305098
+ window.log = window.log.slice(-this.config.retainSize);
305099
+ if (this.config.logToConsole) {
305100
+ console.log(`[Logger] 清理日志: ${beforeLength} -> ${window.log.length}`);
305101
+ }
305102
+ }
305103
+ if (this.config.logToConsole) {
305104
+ const prefix2 = `[${logEntry.component}] ${logEntry.event}`;
305105
+ const message2 = typeof logEntry.content === "string" ? logEntry.content : JSON.stringify(logEntry.content);
305106
+ switch (logEntry.level) {
305107
+ case "error":
305108
+ case "critical":
305109
+ console.error(`${prefix2}: ${message2}`, logEntry.extra);
305110
+ break;
305111
+ case "warn":
305112
+ console.warn(`${prefix2}: ${message2}`, logEntry.extra);
305113
+ break;
305114
+ case "info":
305115
+ console.info(`${prefix2}: ${message2}`, logEntry.extra);
305116
+ break;
305117
+ default:
305118
+ console.debug(`${prefix2}: ${message2}`, logEntry.extra);
305119
+ }
305120
+ }
305121
+ }
305122
+ /**
305123
+ * 公共方法:记录调试日志
305124
+ */
305125
+ debug(data2) {
305126
+ this.logInternal({
305127
+ ...data2,
305128
+ level: "debug"
305129
+ /* DEBUG */
305130
+ });
305131
+ }
305132
+ /**
305133
+ * 公共方法:记录信息日志
305134
+ */
305135
+ info(data2) {
305136
+ this.logInternal({
305137
+ ...data2,
305138
+ level: "info"
305139
+ /* INFO */
305140
+ });
305141
+ }
305142
+ /**
305143
+ * 公共方法:记录警告日志
305144
+ */
305145
+ warn(data2) {
305146
+ this.logInternal({
305147
+ ...data2,
305148
+ level: "warn"
305149
+ /* WARN */
305150
+ });
305151
+ }
305152
+ /**
305153
+ * 公共方法:记录错误日志
305154
+ */
305155
+ error(data2) {
305156
+ this.logInternal({
305157
+ ...data2,
305158
+ level: "error"
305159
+ /* ERROR */
305160
+ });
305161
+ }
305162
+ /**
305163
+ * 公共方法:记录关键错误日志
305164
+ */
305165
+ critical(data2) {
305166
+ this.logInternal({
305167
+ ...data2,
305168
+ level: "critical"
305169
+ /* CRITICAL */
305170
+ });
305171
+ }
305172
+ /**
305173
+ * 手动清理日志
305174
+ */
305175
+ cleanupLogs(retainCount = this.config.retainSize) {
305176
+ if (!window.log || window.log.length <= retainCount) {
305177
+ return 0;
305178
+ }
305179
+ const beforeLength = window.log.length;
305180
+ window.log = window.log.slice(-retainCount);
305181
+ return beforeLength - window.log.length;
305182
+ }
305183
+ /**
305184
+ * 获取日志统计信息
305185
+ */
305186
+ getStats() {
305187
+ if (!window.log)
305188
+ return null;
305189
+ const logs = window.log;
305190
+ const byLevel = {
305191
+ [
305192
+ "debug"
305193
+ /* DEBUG */
305194
+ ]: 0,
305195
+ [
305196
+ "info"
305197
+ /* INFO */
305198
+ ]: 0,
305199
+ [
305200
+ "warn"
305201
+ /* WARN */
305202
+ ]: 0,
305203
+ [
305204
+ "error"
305205
+ /* ERROR */
305206
+ ]: 0,
305207
+ [
305208
+ "critical"
305209
+ /* CRITICAL */
305210
+ ]: 0
305211
+ };
305212
+ logs.forEach((log2) => {
305213
+ const level = log2.level || "info";
305214
+ byLevel[level] = (byLevel[level] || 0) + 1;
305215
+ });
305216
+ const memoryEstimate = this.estimateMemoryUsage(logs);
305217
+ return {
305218
+ total: logs.length,
305219
+ byLevel,
305220
+ memoryEstimate
305221
+ };
305222
+ }
305223
+ /**
305224
+ * 估算日志内存占用
305225
+ */
305226
+ estimateMemoryUsage(logs) {
305227
+ if (!logs || logs.length === 0)
305228
+ return "0KB";
305229
+ const avgSize = 350;
305230
+ const totalBytes = logs.length * avgSize;
305231
+ if (totalBytes < 1024) {
305232
+ return `${totalBytes}B`;
305233
+ } else if (totalBytes < 1024 * 1024) {
305234
+ return `${(totalBytes / 1024).toFixed(2)}KB`;
305235
+ } else {
305236
+ return `${(totalBytes / (1024 * 1024)).toFixed(2)}MB`;
305237
+ }
305238
+ }
305239
+ /**
305240
+ * 清除所有日志
305241
+ */
305242
+ clearLogs() {
305243
+ if (window.log) {
305244
+ const length2 = window.log.length;
305245
+ window.log = [];
305246
+ if (this.config.logToConsole) {
305247
+ console.log(`[Logger] 清除所有日志,共 ${length2} 条`);
305248
+ }
305249
+ }
305250
+ }
305251
+ /**
305252
+ * 更新配置
305253
+ */
305254
+ updateConfig(newConfig) {
305255
+ const oldAutoCleanup = this.config.autoCleanupInterval;
305256
+ this.config = { ...this.config, ...newConfig };
305257
+ if (newConfig.autoCleanupInterval !== void 0 && newConfig.autoCleanupInterval !== oldAutoCleanup) {
305258
+ if (this.cleanupIntervalId) {
305259
+ clearInterval(this.cleanupIntervalId);
305260
+ }
305261
+ if (this.config.autoCleanupInterval && this.config.autoCleanupInterval > 0) {
305262
+ this.startAutoCleanup();
305263
+ }
305264
+ }
305265
+ }
305266
+ /**
305267
+ * 销毁资源
305268
+ */
305269
+ destroy() {
305270
+ if (this.cleanupIntervalId) {
305271
+ clearInterval(this.cleanupIntervalId);
305272
+ this.cleanupIntervalId = null;
305273
+ }
305274
+ }
305275
+ }
305276
+ const logger = new LoggerManager();
304978
305277
  const UserVideoContainer = reactExports.memo(({
304979
305278
  user,
304980
305279
  isSelected = false,
@@ -304982,10 +305281,15 @@ const UserVideoContainer = reactExports.memo(({
304982
305281
  className = "",
304983
305282
  videoId = ""
304984
305283
  }) => {
304985
- window.log.push({
304986
- com: "UserVideoContainer",
304987
- event: "UserVideoContainer mounted",
304988
- content: "进入UserVideoContainer组件"
305284
+ logger.info({
305285
+ component: "UserVideoContainer",
305286
+ event: "component_mounted",
305287
+ content: "组件挂载",
305288
+ extra: {
305289
+ userId: user.rtc_userid,
305290
+ videoId,
305291
+ isSelected
305292
+ }
304989
305293
  });
304990
305294
  const {
304991
305295
  rtc,
@@ -305041,14 +305345,18 @@ const UserVideoContainer = reactExports.memo(({
305041
305345
  shouldMirror: +!noMirror
305042
305346
  });
305043
305347
  const isModeFit = user.rtc_userid === callConfig.drawing_board_id || (videoId == null ? void 0 : videoId.includes("screen")) || user.device === "pc" || videoId.includes("self");
305044
- window.log.push({
305045
- com: "UserVideoContainer",
305046
- params: {
305047
- user,
305048
- videoId
305049
- },
305050
- event: "isModeFit",
305051
- content: `isModeFit ${isModeFit}`
305348
+ logger.debug({
305349
+ component: "UserVideoContainer",
305350
+ event: "video_mode_calculated",
305351
+ content: `isModeFit = ${isModeFit}`,
305352
+ extra: {
305353
+ userId: user.rtc_userid,
305354
+ videoId,
305355
+ isScreen: videoId == null ? void 0 : videoId.includes("screen"),
305356
+ isSelf: videoId.includes("self"),
305357
+ userDevice: user.device,
305358
+ isDrawingBoard: user.rtc_userid === callConfig.drawing_board_id
305359
+ }
305052
305360
  });
305053
305361
  if (user.rtc_userid === callConfig.rtc_userid) {
305054
305362
  rtc.engine.setLocalVideoPlayer((videoId == null ? void 0 : videoId.includes("screen")) ? StreamIndex$1.STREAM_INDEX_SCREEN : StreamIndex$1.STREAM_INDEX_MAIN, {
@@ -305067,19 +305375,17 @@ const UserVideoContainer = reactExports.memo(({
305067
305375
  });
305068
305376
  rtc == null ? void 0 : rtc.engine.setRemoteVideoMirrorType(user.rtc_userid, StreamIndex$1.STREAM_INDEX_MAIN, +!noMirror);
305069
305377
  }
305070
- window.log.push({
305071
- com: "UserVideoContainer",
305072
- params: {
305073
- StreamIndex: (videoId == null ? void 0 : videoId.includes("screen")) ? StreamIndex$1.STREAM_INDEX_SCREEN : StreamIndex$1.STREAM_INDEX_MAIN,
305074
- videoOption: {
305075
- userId: user.rtc_userid,
305076
- renderDom: videoId,
305077
- playerId: videoId,
305078
- renderMode: isModeFit ? VideoRenderMode.RENDER_MODE_FIT : VideoRenderMode.RENDER_MODE_HIDDEN
305079
- }
305080
- },
305081
- event: "setVideoPlayer",
305082
- content: `设置视频播放器 ${videoId}`
305378
+ logger.info({
305379
+ component: "UserVideoContainer",
305380
+ event: "video_player_setup",
305381
+ content: `设置视频播放器 ${videoId}`,
305382
+ extra: {
305383
+ userId: user.rtc_userid,
305384
+ videoId,
305385
+ isSelf: user.rtc_userid === callConfig.rtc_userid,
305386
+ streamIndex: (videoId == null ? void 0 : videoId.includes("screen")) ? "STREAM_INDEX_SCREEN" : "STREAM_INDEX_MAIN",
305387
+ renderMode: isModeFit ? "RENDER_MODE_FIT" : "RENDER_MODE_HIDDEN"
305388
+ }
305083
305389
  });
305084
305390
  return () => {
305085
305391
  if (user.rtc_userid === callConfig.rtc_userid) {
@@ -305761,10 +306067,13 @@ const LiveWaitingRoom = ({
305761
306067
  const MobileLive = reactExports.memo(({
305762
306068
  className = ""
305763
306069
  }) => {
305764
- window.log.push({
305765
- com: "MobileLive",
305766
- event: "MobileLive mounted",
305767
- content: "进入MobileLive组件"
306070
+ logger.info({
306071
+ component: "MobileLive",
306072
+ event: "component_mounted",
306073
+ content: "进入MobileLive组件",
306074
+ extra: {
306075
+ userAgent: navigator.userAgent
306076
+ }
305768
306077
  });
305769
306078
  const {
305770
306079
  layoutMode,