call-live-sdk1 0.0.35 → 0.0.37
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/dist/call-live-sdk.es.js +381 -275
- package/dist/call-live-sdk.umd.js +1 -1
- package/dist/sdk/index.d.ts +16 -0
- package/dist/stats-prod.html +1 -1
- package/dist/utils/logger.d.ts +19 -14
- package/package.json +1 -1
- package/dist/components/EnvExample.d.ts +0 -7
- package/dist/utils/logHelper.d.ts +0 -40
package/dist/call-live-sdk.es.js
CHANGED
|
@@ -169789,6 +169789,41 @@ function debounce$2(func, wait2, options) {
|
|
|
169789
169789
|
debounced.flush = flush3;
|
|
169790
169790
|
return debounced;
|
|
169791
169791
|
}
|
|
169792
|
+
const CountDown = ({ isLive }) => {
|
|
169793
|
+
const [timer, setTimer] = reactExports.useState("00:00:00");
|
|
169794
|
+
const timerIntervalRef = reactExports.useRef(null);
|
|
169795
|
+
const secondsRef = reactExports.useRef(0);
|
|
169796
|
+
const formatTime2 = (totalSeconds) => {
|
|
169797
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
169798
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
169799
|
+
const seconds = totalSeconds % 60;
|
|
169800
|
+
return [hours, minutes, seconds].map((v3) => v3 < 10 ? `0${v3}` : v3).join(":");
|
|
169801
|
+
};
|
|
169802
|
+
reactExports.useEffect(() => {
|
|
169803
|
+
if (isLive) {
|
|
169804
|
+
secondsRef.current = 0;
|
|
169805
|
+
setTimer("00:00:00");
|
|
169806
|
+
timerIntervalRef.current = setInterval(() => {
|
|
169807
|
+
secondsRef.current += 1;
|
|
169808
|
+
setTimer(formatTime2(secondsRef.current));
|
|
169809
|
+
}, 1e3);
|
|
169810
|
+
} else {
|
|
169811
|
+
if (timerIntervalRef.current) {
|
|
169812
|
+
clearInterval(timerIntervalRef.current);
|
|
169813
|
+
timerIntervalRef.current = null;
|
|
169814
|
+
}
|
|
169815
|
+
secondsRef.current = 0;
|
|
169816
|
+
setTimer("00:00:00");
|
|
169817
|
+
}
|
|
169818
|
+
return () => {
|
|
169819
|
+
if (timerIntervalRef.current) {
|
|
169820
|
+
clearInterval(timerIntervalRef.current);
|
|
169821
|
+
}
|
|
169822
|
+
};
|
|
169823
|
+
}, [isLive]);
|
|
169824
|
+
return isLive && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-16px text-#fff h-full flex items-center mr-3", children: timer });
|
|
169825
|
+
};
|
|
169826
|
+
const CountDown$1 = reactExports.memo(CountDown);
|
|
169792
169827
|
const useLivePushCodeStore = create$c((set3, get4) => ({
|
|
169793
169828
|
livePushCode: null,
|
|
169794
169829
|
isLoading: false,
|
|
@@ -169862,41 +169897,6 @@ const useCommentChatUrlStore = create$c((set3) => ({
|
|
|
169862
169897
|
}
|
|
169863
169898
|
}
|
|
169864
169899
|
}));
|
|
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);
|
|
169900
169900
|
const useActivityTypeStore = create$c((set3, get4) => ({
|
|
169901
169901
|
activityType: {
|
|
169902
169902
|
active_type: 0
|
|
@@ -188598,6 +188598,16 @@ const subscribeWithSelectorImpl = (fn2) => (set3, get4, api) => {
|
|
|
188598
188598
|
return initialState;
|
|
188599
188599
|
};
|
|
188600
188600
|
const subscribeWithSelector = subscribeWithSelectorImpl;
|
|
188601
|
+
const useGuestStore = create$c()((set3, get4) => ({
|
|
188602
|
+
status: 0,
|
|
188603
|
+
deviceType: "pc",
|
|
188604
|
+
setDeviceType: (deviceType) => {
|
|
188605
|
+
set3({ deviceType });
|
|
188606
|
+
},
|
|
188607
|
+
setStatus: (status) => {
|
|
188608
|
+
set3({ status });
|
|
188609
|
+
}
|
|
188610
|
+
}));
|
|
188601
188611
|
var VideoType = /* @__PURE__ */ ((VideoType2) => {
|
|
188602
188612
|
VideoType2["CAMERA"] = "video";
|
|
188603
188613
|
VideoType2["SCREEN"] = "screen";
|
|
@@ -188617,16 +188627,6 @@ var LayoutMode = /* @__PURE__ */ ((LayoutMode2) => {
|
|
|
188617
188627
|
LayoutMode2["GRID"] = "grid";
|
|
188618
188628
|
return LayoutMode2;
|
|
188619
188629
|
})(LayoutMode || {});
|
|
188620
|
-
const useGuestStore = create$c()((set3, get4) => ({
|
|
188621
|
-
status: 0,
|
|
188622
|
-
deviceType: "pc",
|
|
188623
|
-
setDeviceType: (deviceType) => {
|
|
188624
|
-
set3({ deviceType });
|
|
188625
|
-
},
|
|
188626
|
-
setStatus: (status) => {
|
|
188627
|
-
set3({ status });
|
|
188628
|
-
}
|
|
188629
|
-
}));
|
|
188630
188630
|
const updateRTCStorageConfig = async (params) => {
|
|
188631
188631
|
return request("/bis/rtc/storage/config", {
|
|
188632
188632
|
method: "POST",
|
|
@@ -211312,73 +211312,6 @@ class bh extends Va {
|
|
|
211312
211312
|
}
|
|
211313
211313
|
}
|
|
211314
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
|
-
};
|
|
211382
211315
|
function _extends$y() {
|
|
211383
211316
|
_extends$y = Object.assign ? Object.assign.bind() : function(target) {
|
|
211384
211317
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -211851,6 +211784,73 @@ const CallSingleColumnLayout = ({
|
|
|
211851
211784
|
})]
|
|
211852
211785
|
});
|
|
211853
211786
|
};
|
|
211787
|
+
const useCallUserPagination = (config2) => {
|
|
211788
|
+
const { gridCols } = config2;
|
|
211789
|
+
const [currentPage, setCurrentPage] = reactExports.useState(1);
|
|
211790
|
+
const { callUsers, setCallUsersCurrentPageRef, layoutMode } = useCallStore();
|
|
211791
|
+
reactExports.useEffect(() => {
|
|
211792
|
+
setCallUsersCurrentPageRef(currentPage);
|
|
211793
|
+
}, [currentPage]);
|
|
211794
|
+
reactExports.useEffect(() => {
|
|
211795
|
+
setCurrentPage(1);
|
|
211796
|
+
}, [layoutMode]);
|
|
211797
|
+
const usersPerPage = reactExports.useMemo(() => {
|
|
211798
|
+
return gridCols <= 1 ? 5 : 9;
|
|
211799
|
+
}, [gridCols]);
|
|
211800
|
+
const getTotalVideoCount = reactExports.useMemo(() => {
|
|
211801
|
+
const videoList = callUsers.flatMap((item) => {
|
|
211802
|
+
var _a2, _b, _c2;
|
|
211803
|
+
if (item.waiting_mode_state === WaitingModeState.WAITING) {
|
|
211804
|
+
return [];
|
|
211805
|
+
}
|
|
211806
|
+
if (item.isScreenEnabled) {
|
|
211807
|
+
return [(_a2 = item.videoList) == null ? void 0 : _a2[1], (_b = item.videoList) == null ? void 0 : _b[0]];
|
|
211808
|
+
}
|
|
211809
|
+
return [(_c2 = item.videoList) == null ? void 0 : _c2[0]];
|
|
211810
|
+
});
|
|
211811
|
+
return videoList.length;
|
|
211812
|
+
}, [callUsers]);
|
|
211813
|
+
reactExports.useEffect(() => {
|
|
211814
|
+
if (gridCols <= 1 && getTotalVideoCount <= 5) {
|
|
211815
|
+
setCurrentPage(1);
|
|
211816
|
+
}
|
|
211817
|
+
}, [gridCols, getTotalVideoCount]);
|
|
211818
|
+
const getTotalPages = reactExports.useMemo(() => {
|
|
211819
|
+
return Math.ceil(getTotalVideoCount / usersPerPage) || 1;
|
|
211820
|
+
}, [getTotalVideoCount, usersPerPage]);
|
|
211821
|
+
const calculateOptimalGridCols = (userCount, defaultGridCols) => {
|
|
211822
|
+
if (defaultGridCols <= 1)
|
|
211823
|
+
return defaultGridCols;
|
|
211824
|
+
if (userCount <= 1)
|
|
211825
|
+
return 1;
|
|
211826
|
+
if (userCount === 2)
|
|
211827
|
+
return 2;
|
|
211828
|
+
if (userCount <= 4)
|
|
211829
|
+
return 2;
|
|
211830
|
+
if (userCount <= 9)
|
|
211831
|
+
return 3;
|
|
211832
|
+
return 3;
|
|
211833
|
+
};
|
|
211834
|
+
const handlePrevPage = () => {
|
|
211835
|
+
setCurrentPage((prev2) => Math.max(prev2 - 1, 1));
|
|
211836
|
+
};
|
|
211837
|
+
const handleNextPage = () => {
|
|
211838
|
+
setCurrentPage((prev2) => Math.min(prev2 + 1, getTotalPages));
|
|
211839
|
+
};
|
|
211840
|
+
const goToPage = (pageNumber) => {
|
|
211841
|
+
setCurrentPage(Math.min(Math.max(pageNumber, 1), getTotalPages));
|
|
211842
|
+
};
|
|
211843
|
+
return {
|
|
211844
|
+
currentPage,
|
|
211845
|
+
usersPerPage,
|
|
211846
|
+
totalPages: getTotalPages,
|
|
211847
|
+
totalVideoCount: getTotalVideoCount,
|
|
211848
|
+
handlePrevPage,
|
|
211849
|
+
handleNextPage,
|
|
211850
|
+
goToPage,
|
|
211851
|
+
calculateOptimalGridCols
|
|
211852
|
+
};
|
|
211853
|
+
};
|
|
211854
211854
|
const useOnlineUsers = () => {
|
|
211855
211855
|
const { callUsers, callConfig } = useCallStore();
|
|
211856
211856
|
const [isLoading, setIsLoading] = reactExports.useState(false);
|
|
@@ -270454,87 +270454,6 @@ const SvgGuideO = reactExports.forwardRef((props, ref) => {
|
|
|
270454
270454
|
reactExports.createElement(SvgIcon$6, null)
|
|
270455
270455
|
);
|
|
270456
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
|
-
}));
|
|
270538
270457
|
const ShapeTypePicker = reactExports.memo(
|
|
270539
270458
|
({
|
|
270540
270459
|
types: types2 = ["rect", "circle"],
|
|
@@ -270682,6 +270601,87 @@ const ToolOption = reactExports.memo(({
|
|
|
270682
270601
|
});
|
|
270683
270602
|
});
|
|
270684
270603
|
ToolOption.displayName = "ToolOption";
|
|
270604
|
+
const useDrawingToolsStore = create$c((set3, get4) => ({
|
|
270605
|
+
// 选中的工具
|
|
270606
|
+
selectedTool: 0,
|
|
270607
|
+
setSelectedTool: (tool) => set3({ selectedTool: tool }),
|
|
270608
|
+
// 画笔设置
|
|
270609
|
+
penSize: 2,
|
|
270610
|
+
setPenSize: (size) => set3((state) => {
|
|
270611
|
+
const newSize = typeof size === "function" ? size(state.penSize) : size;
|
|
270612
|
+
return {
|
|
270613
|
+
penSize: newSize
|
|
270614
|
+
};
|
|
270615
|
+
}),
|
|
270616
|
+
penColor: "#ff5a5a",
|
|
270617
|
+
setPenColor: (color) => set3((state) => {
|
|
270618
|
+
const newColor = typeof color === "function" ? color(state.penColor) : color;
|
|
270619
|
+
return {
|
|
270620
|
+
penColor: newColor
|
|
270621
|
+
};
|
|
270622
|
+
}),
|
|
270623
|
+
// 激光笔设置
|
|
270624
|
+
laserPenSize: 2,
|
|
270625
|
+
setLaserPenSize: (size) => set3((state) => {
|
|
270626
|
+
const newSize = typeof size === "function" ? size(state.laserPenSize) : size;
|
|
270627
|
+
return {
|
|
270628
|
+
laserPenSize: newSize
|
|
270629
|
+
};
|
|
270630
|
+
}),
|
|
270631
|
+
laserPenColor: "#ff5a5a",
|
|
270632
|
+
setLaserPenColor: (color) => set3((state) => {
|
|
270633
|
+
const newColor = typeof color === "function" ? color(state.laserPenColor) : color;
|
|
270634
|
+
return {
|
|
270635
|
+
laserPenColor: newColor
|
|
270636
|
+
};
|
|
270637
|
+
}),
|
|
270638
|
+
// 形状设置
|
|
270639
|
+
shapeSize: 2,
|
|
270640
|
+
setShapeSize: (size) => set3((state) => {
|
|
270641
|
+
const newSize = typeof size === "function" ? size(state.shapeSize) : size;
|
|
270642
|
+
return {
|
|
270643
|
+
shapeSize: newSize
|
|
270644
|
+
};
|
|
270645
|
+
}),
|
|
270646
|
+
shapeType: "rect",
|
|
270647
|
+
setShapeType: (type4) => set3((state) => {
|
|
270648
|
+
const newType = typeof type4 === "function" ? type4(state.shapeType) : type4;
|
|
270649
|
+
return {
|
|
270650
|
+
shapeType: newType,
|
|
270651
|
+
shapeTypeRef: { current: newType }
|
|
270652
|
+
};
|
|
270653
|
+
}),
|
|
270654
|
+
shapeColor: "#ff5a5a",
|
|
270655
|
+
setShapeColor: (color) => set3((state) => {
|
|
270656
|
+
const newColor = typeof color === "function" ? color(state.shapeColor) : color;
|
|
270657
|
+
return {
|
|
270658
|
+
shapeColor: newColor
|
|
270659
|
+
};
|
|
270660
|
+
}),
|
|
270661
|
+
// 文字设置
|
|
270662
|
+
textSize: 16,
|
|
270663
|
+
setTextSize: (size) => set3((state) => {
|
|
270664
|
+
const newSize = typeof size === "function" ? size(state.textSize) : size;
|
|
270665
|
+
return {
|
|
270666
|
+
textSize: newSize
|
|
270667
|
+
};
|
|
270668
|
+
}),
|
|
270669
|
+
textColor: "#ff5a5a",
|
|
270670
|
+
setTextColor: (color) => set3((state) => {
|
|
270671
|
+
const newColor = typeof color === "function" ? color(state.textColor) : color;
|
|
270672
|
+
return {
|
|
270673
|
+
textColor: newColor
|
|
270674
|
+
};
|
|
270675
|
+
}),
|
|
270676
|
+
// 预览弹窗状态
|
|
270677
|
+
isPreviewModalVisible: false,
|
|
270678
|
+
setIsPreviewModalVisible: (visible) => set3({ isPreviewModalVisible: visible }),
|
|
270679
|
+
// 绘图相关引用
|
|
270680
|
+
downPoint: { current: null },
|
|
270681
|
+
upPoint: { current: null },
|
|
270682
|
+
currentShape: { current: null },
|
|
270683
|
+
getter: () => get4()
|
|
270684
|
+
}));
|
|
270685
270685
|
const COLORS = ["#ff5a5a", "#ffbf48", "#3a9bff", "#58efb8", "#000000", "#808080", "#ffffff"];
|
|
270686
270686
|
const LINE_SIZES = [2, 4, 6];
|
|
270687
270687
|
const TEXT_SIZES = [16, 20, 24, 28, 32];
|
|
@@ -304994,22 +304994,42 @@ const PageIndicator = reactExports.memo(
|
|
|
304994
304994
|
}
|
|
304995
304995
|
);
|
|
304996
304996
|
PageIndicator.displayName = "PageIndicator";
|
|
304997
|
+
const SDK_DEFAULT_CONFIG = {
|
|
304998
|
+
enabled: true,
|
|
304999
|
+
// SDK环境默认启用日志
|
|
305000
|
+
maxSize: 500,
|
|
305001
|
+
// SDK环境日志较少
|
|
305002
|
+
cleanupThreshold: 600,
|
|
305003
|
+
retainSize: 400,
|
|
305004
|
+
autoCleanupInterval: 3e4,
|
|
305005
|
+
// 30秒清理一次
|
|
305006
|
+
logToConsole: false,
|
|
305007
|
+
// SDK环境不输出到控制台
|
|
305008
|
+
levelFilter: "info"
|
|
305009
|
+
/* INFO */
|
|
305010
|
+
// SDK环境默认info级别
|
|
305011
|
+
};
|
|
304997
305012
|
const DEFAULT_CONFIG = {
|
|
304998
|
-
enabled:
|
|
305013
|
+
enabled: true,
|
|
304999
305014
|
// 开发环境默认启用
|
|
305000
|
-
maxSize:
|
|
305015
|
+
maxSize: 500,
|
|
305016
|
+
// 最大缓存条目数量
|
|
305001
305017
|
cleanupThreshold: 1200,
|
|
305018
|
+
// 触发清理的阈值
|
|
305002
305019
|
retainSize: 800,
|
|
305020
|
+
// 清理后保留的条目数量
|
|
305003
305021
|
autoCleanupInterval: 6e4,
|
|
305004
|
-
//
|
|
305022
|
+
// 自动清理间隔时间(毫秒)
|
|
305005
305023
|
logToConsole: true,
|
|
305024
|
+
// 是否输出日志到控制台
|
|
305006
305025
|
levelFilter: "debug"
|
|
305007
305026
|
/* DEBUG */
|
|
305027
|
+
// 日志级别过滤
|
|
305008
305028
|
};
|
|
305009
305029
|
class LoggerManager {
|
|
305010
|
-
constructor(config2 = {}) {
|
|
305030
|
+
constructor(config2 = {}, isSDK = true) {
|
|
305011
305031
|
this.cleanupIntervalId = null;
|
|
305012
|
-
this.config = { ...DEFAULT_CONFIG, ...config2 };
|
|
305032
|
+
this.config = { ...isSDK ? SDK_DEFAULT_CONFIG : DEFAULT_CONFIG, ...config2 };
|
|
305013
305033
|
this.initialize();
|
|
305014
305034
|
}
|
|
305015
305035
|
/**
|
|
@@ -305019,29 +305039,6 @@ class LoggerManager {
|
|
|
305019
305039
|
if (!window.log) {
|
|
305020
305040
|
window.log = [];
|
|
305021
305041
|
}
|
|
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
305042
|
}
|
|
305046
305043
|
/**
|
|
305047
305044
|
* 检查是否应该记录此级别日志
|
|
@@ -305093,13 +305090,7 @@ class LoggerManager {
|
|
|
305093
305090
|
...data2
|
|
305094
305091
|
};
|
|
305095
305092
|
window.log.push(logEntry);
|
|
305096
|
-
|
|
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
|
-
}
|
|
305093
|
+
this.cleanupIfNeeded();
|
|
305103
305094
|
if (this.config.logToConsole) {
|
|
305104
305095
|
const prefix2 = `[${logEntry.component}] ${logEntry.event}`;
|
|
305105
305096
|
const message2 = typeof logEntry.content === "string" ? logEntry.content : JSON.stringify(logEntry.content);
|
|
@@ -305119,6 +305110,22 @@ class LoggerManager {
|
|
|
305119
305110
|
}
|
|
305120
305111
|
}
|
|
305121
305112
|
}
|
|
305113
|
+
/**
|
|
305114
|
+
* 检查并清理超出的日志(安全检查,确保内存安全)
|
|
305115
|
+
* 方案2优化:使用两级阈值检测
|
|
305116
|
+
*/
|
|
305117
|
+
cleanupIfNeeded() {
|
|
305118
|
+
const logs = window.log;
|
|
305119
|
+
if (!logs || logs.length === 0)
|
|
305120
|
+
return;
|
|
305121
|
+
const safetyThreshold = this.config.maxSize * 1.5;
|
|
305122
|
+
if (logs.length > safetyThreshold) {
|
|
305123
|
+
console.warn(
|
|
305124
|
+
`[Logger] 内存安全警告:日志量(${logs.length})超过安全阈值(${safetyThreshold}),紧急清理`
|
|
305125
|
+
);
|
|
305126
|
+
this.cleanupLogs(this.config.maxSize);
|
|
305127
|
+
}
|
|
305128
|
+
}
|
|
305122
305129
|
/**
|
|
305123
305130
|
* 公共方法:记录调试日志
|
|
305124
305131
|
*/
|
|
@@ -305248,21 +305255,6 @@ class LoggerManager {
|
|
|
305248
305255
|
}
|
|
305249
305256
|
}
|
|
305250
305257
|
}
|
|
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
305258
|
/**
|
|
305267
305259
|
* 销毁资源
|
|
305268
305260
|
*/
|
|
@@ -305272,8 +305264,37 @@ class LoggerManager {
|
|
|
305272
305264
|
this.cleanupIntervalId = null;
|
|
305273
305265
|
}
|
|
305274
305266
|
}
|
|
305267
|
+
/**
|
|
305268
|
+
* SDK专用:导出日志数据(用于诊断和调试)
|
|
305269
|
+
*/
|
|
305270
|
+
exportLogs(count2 = 100) {
|
|
305271
|
+
if (!window.log)
|
|
305272
|
+
return [];
|
|
305273
|
+
const logs = window.log;
|
|
305274
|
+
return logs.slice(-count2).map((log2, index2) => ({
|
|
305275
|
+
...log2,
|
|
305276
|
+
index: logs.length - count2 + index2
|
|
305277
|
+
}));
|
|
305278
|
+
}
|
|
305279
|
+
/**
|
|
305280
|
+
* SDK专用:获取SDK环境下的日志统计
|
|
305281
|
+
*/
|
|
305282
|
+
getSDKStats() {
|
|
305283
|
+
if (!window.log)
|
|
305284
|
+
return { total: 0, errors: 0, warnings: 0 };
|
|
305285
|
+
const logs = window.log;
|
|
305286
|
+
const errors = logs.filter(
|
|
305287
|
+
(log2) => log2.level === "error" || log2.level === "critical"
|
|
305288
|
+
/* CRITICAL */
|
|
305289
|
+
).length;
|
|
305290
|
+
const warnings = logs.filter(
|
|
305291
|
+
(log2) => log2.level === "warn"
|
|
305292
|
+
/* WARN */
|
|
305293
|
+
).length;
|
|
305294
|
+
return { total: logs.length, errors, warnings };
|
|
305295
|
+
}
|
|
305275
305296
|
}
|
|
305276
|
-
const logger = new LoggerManager();
|
|
305297
|
+
const logger = new LoggerManager({});
|
|
305277
305298
|
const UserVideoContainer = reactExports.memo(({
|
|
305278
305299
|
user,
|
|
305279
305300
|
isSelected = false,
|
|
@@ -305281,16 +305302,6 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305281
305302
|
className = "",
|
|
305282
305303
|
videoId = ""
|
|
305283
305304
|
}) => {
|
|
305284
|
-
logger.info({
|
|
305285
|
-
component: "UserVideoContainer",
|
|
305286
|
-
event: "component_mounted",
|
|
305287
|
-
content: "组件挂载",
|
|
305288
|
-
extra: {
|
|
305289
|
-
userId: user.rtc_userid,
|
|
305290
|
-
videoId,
|
|
305291
|
-
isSelected
|
|
305292
|
-
}
|
|
305293
|
-
});
|
|
305294
305305
|
const {
|
|
305295
305306
|
rtc,
|
|
305296
305307
|
callConfig
|
|
@@ -305345,19 +305356,6 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305345
305356
|
shouldMirror: +!noMirror
|
|
305346
305357
|
});
|
|
305347
305358
|
const isModeFit = user.rtc_userid === callConfig.drawing_board_id || (videoId == null ? void 0 : videoId.includes("screen")) || user.device === "pc" || videoId.includes("self");
|
|
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
|
-
}
|
|
305360
|
-
});
|
|
305361
305359
|
if (user.rtc_userid === callConfig.rtc_userid) {
|
|
305362
305360
|
rtc.engine.setLocalVideoPlayer((videoId == null ? void 0 : videoId.includes("screen")) ? StreamIndex$1.STREAM_INDEX_SCREEN : StreamIndex$1.STREAM_INDEX_MAIN, {
|
|
305363
305361
|
userId: user.rtc_userid,
|
|
@@ -306067,14 +306065,6 @@ const LiveWaitingRoom = ({
|
|
|
306067
306065
|
const MobileLive = reactExports.memo(({
|
|
306068
306066
|
className = ""
|
|
306069
306067
|
}) => {
|
|
306070
|
-
logger.info({
|
|
306071
|
-
component: "MobileLive",
|
|
306072
|
-
event: "component_mounted",
|
|
306073
|
-
content: "进入MobileLive组件",
|
|
306074
|
-
extra: {
|
|
306075
|
-
userAgent: navigator.userAgent
|
|
306076
|
-
}
|
|
306077
|
-
});
|
|
306078
306068
|
const {
|
|
306079
306069
|
layoutMode,
|
|
306080
306070
|
rtc,
|
|
@@ -306205,6 +306195,17 @@ const MobileLive = reactExports.memo(({
|
|
|
306205
306195
|
window.callConfig = callConfig;
|
|
306206
306196
|
window.rtc = rtc;
|
|
306207
306197
|
}, [callUsers, callConfig, rtc]);
|
|
306198
|
+
reactExports.useEffect(() => {
|
|
306199
|
+
logger.info({
|
|
306200
|
+
component: "MobileLive",
|
|
306201
|
+
event: "component_mounted",
|
|
306202
|
+
content: "进入MobileLive组件",
|
|
306203
|
+
extra: {
|
|
306204
|
+
userAgent: navigator.userAgent,
|
|
306205
|
+
isMobile: isMobile$3
|
|
306206
|
+
}
|
|
306207
|
+
});
|
|
306208
|
+
}, []);
|
|
306208
306209
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ConfigProvider$1, {
|
|
306209
306210
|
theme: {
|
|
306210
306211
|
algorithm: theme.darkAlgorithm,
|
|
@@ -306345,6 +306346,7 @@ class CallLiveSdk {
|
|
|
306345
306346
|
}
|
|
306346
306347
|
});
|
|
306347
306348
|
this.config = config2;
|
|
306349
|
+
this.initSDKLogger();
|
|
306348
306350
|
useSdkStore.setState({
|
|
306349
306351
|
callConfig: this.config
|
|
306350
306352
|
});
|
|
@@ -306417,6 +306419,49 @@ class CallLiveSdk {
|
|
|
306417
306419
|
this.root.unmount();
|
|
306418
306420
|
this.root = null;
|
|
306419
306421
|
}
|
|
306422
|
+
logger.info({
|
|
306423
|
+
component: "CallLiveSdk",
|
|
306424
|
+
event: "sdk_destroyed",
|
|
306425
|
+
content: "SDK已销毁并清理资源",
|
|
306426
|
+
extra: {
|
|
306427
|
+
liveId: this.config.liveId
|
|
306428
|
+
}
|
|
306429
|
+
});
|
|
306430
|
+
}
|
|
306431
|
+
/**
|
|
306432
|
+
* 初始化SDK日志系统
|
|
306433
|
+
*/
|
|
306434
|
+
initSDKLogger() {
|
|
306435
|
+
window.__CALL_SDK__ = true;
|
|
306436
|
+
if (!window.log) {
|
|
306437
|
+
window.log = [];
|
|
306438
|
+
}
|
|
306439
|
+
logger.info({
|
|
306440
|
+
component: "CallLiveSdk",
|
|
306441
|
+
event: "sdk_initialized",
|
|
306442
|
+
content: "CallLiveSdk初始化完成",
|
|
306443
|
+
extra: {
|
|
306444
|
+
liveId: this.config.liveId,
|
|
306445
|
+
agentId: this.config.agentId,
|
|
306446
|
+
sdkVersion: "v1.0.0"
|
|
306447
|
+
// TODO: 从package.json获取
|
|
306448
|
+
}
|
|
306449
|
+
});
|
|
306450
|
+
window.addEventListener("error", (event) => {
|
|
306451
|
+
var _a2;
|
|
306452
|
+
logger.error({
|
|
306453
|
+
component: "SDK Error",
|
|
306454
|
+
event: "window_error",
|
|
306455
|
+
content: "捕获到window错误",
|
|
306456
|
+
extra: {
|
|
306457
|
+
message: event.message,
|
|
306458
|
+
filename: event.filename,
|
|
306459
|
+
lineno: event.lineno,
|
|
306460
|
+
colno: event.colno,
|
|
306461
|
+
error: (_a2 = event.error) == null ? void 0 : _a2.toString()
|
|
306462
|
+
}
|
|
306463
|
+
});
|
|
306464
|
+
});
|
|
306420
306465
|
}
|
|
306421
306466
|
}
|
|
306422
306467
|
class GuestCallSdk {
|
|
@@ -306428,6 +306473,7 @@ class GuestCallSdk {
|
|
|
306428
306473
|
}
|
|
306429
306474
|
});
|
|
306430
306475
|
this.config = config2;
|
|
306476
|
+
this.initSDKLogger();
|
|
306431
306477
|
useSdkStore.setState({
|
|
306432
306478
|
guestConfig: config2
|
|
306433
306479
|
});
|
|
@@ -306468,6 +306514,66 @@ class GuestCallSdk {
|
|
|
306468
306514
|
})
|
|
306469
306515
|
}));
|
|
306470
306516
|
}
|
|
306517
|
+
/**
|
|
306518
|
+
* 获取当前配置
|
|
306519
|
+
*/
|
|
306520
|
+
getConfig() {
|
|
306521
|
+
return {
|
|
306522
|
+
...this.config
|
|
306523
|
+
};
|
|
306524
|
+
}
|
|
306525
|
+
/**
|
|
306526
|
+
* 销毁SDK
|
|
306527
|
+
*/
|
|
306528
|
+
destroy() {
|
|
306529
|
+
if (this.root) {
|
|
306530
|
+
this.root.unmount();
|
|
306531
|
+
this.root = null;
|
|
306532
|
+
}
|
|
306533
|
+
logger.info({
|
|
306534
|
+
component: "GuestCallSdk",
|
|
306535
|
+
event: "sdk_destroyed",
|
|
306536
|
+
content: "Guest SDK已销毁并清理资源",
|
|
306537
|
+
extra: {
|
|
306538
|
+
liveId: this.config.liveId
|
|
306539
|
+
}
|
|
306540
|
+
});
|
|
306541
|
+
}
|
|
306542
|
+
/**
|
|
306543
|
+
* 初始化SDK日志系统
|
|
306544
|
+
*/
|
|
306545
|
+
initSDKLogger() {
|
|
306546
|
+
window.__GUEST_SDK__ = true;
|
|
306547
|
+
if (!window.log) {
|
|
306548
|
+
window.log = [];
|
|
306549
|
+
}
|
|
306550
|
+
logger.info({
|
|
306551
|
+
component: "GuestCallSdk",
|
|
306552
|
+
event: "sdk_initialized",
|
|
306553
|
+
content: "GuestCallSdk初始化完成",
|
|
306554
|
+
extra: {
|
|
306555
|
+
liveId: this.config.liveId,
|
|
306556
|
+
agentId: this.config.agentId,
|
|
306557
|
+
sdkVersion: "v1.0.0"
|
|
306558
|
+
// TODO: 从package.json获取
|
|
306559
|
+
}
|
|
306560
|
+
});
|
|
306561
|
+
window.addEventListener("error", (event) => {
|
|
306562
|
+
var _a2;
|
|
306563
|
+
logger.error({
|
|
306564
|
+
component: "SDK Error",
|
|
306565
|
+
event: "window_error",
|
|
306566
|
+
content: "捕获到window错误",
|
|
306567
|
+
extra: {
|
|
306568
|
+
message: event.message,
|
|
306569
|
+
filename: event.filename,
|
|
306570
|
+
lineno: event.lineno,
|
|
306571
|
+
colno: event.colno,
|
|
306572
|
+
error: (_a2 = event.error) == null ? void 0 : _a2.toString()
|
|
306573
|
+
}
|
|
306574
|
+
});
|
|
306575
|
+
});
|
|
306576
|
+
}
|
|
306471
306577
|
}
|
|
306472
306578
|
export {
|
|
306473
306579
|
CallLiveSdk,
|