call-live-sdk1 0.0.36 → 0.0.38
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 +11 -73
- package/dist/call-live-sdk.umd.js +1 -1
- package/dist/stats-prod.html +1 -1
- package/dist/utils/logger.d.ts +2 -15
- package/package.json +1 -1
package/dist/call-live-sdk.es.js
CHANGED
|
@@ -305010,9 +305010,9 @@ const SDK_DEFAULT_CONFIG = {
|
|
|
305010
305010
|
// SDK环境默认info级别
|
|
305011
305011
|
};
|
|
305012
305012
|
const DEFAULT_CONFIG = {
|
|
305013
|
-
enabled:
|
|
305013
|
+
enabled: true,
|
|
305014
305014
|
// 开发环境默认启用
|
|
305015
|
-
maxSize:
|
|
305015
|
+
maxSize: 500,
|
|
305016
305016
|
// 最大缓存条目数量
|
|
305017
305017
|
cleanupThreshold: 1200,
|
|
305018
305018
|
// 触发清理的阈值
|
|
@@ -305026,22 +305026,9 @@ const DEFAULT_CONFIG = {
|
|
|
305026
305026
|
/* DEBUG */
|
|
305027
305027
|
// 日志级别过滤
|
|
305028
305028
|
};
|
|
305029
|
-
const isSDKEnvironment = () => {
|
|
305030
|
-
if (typeof window === "undefined")
|
|
305031
|
-
return false;
|
|
305032
|
-
if (window.__CALL_SDK__ || window.__GUEST_SDK__) {
|
|
305033
|
-
return true;
|
|
305034
|
-
}
|
|
305035
|
-
const hasSDKConfig = Boolean(
|
|
305036
|
-
window.callConfig || window.guestConfig || document.querySelector("[data-sdk-embedded]")
|
|
305037
|
-
);
|
|
305038
|
-
return hasSDKConfig;
|
|
305039
|
-
};
|
|
305040
305029
|
class LoggerManager {
|
|
305041
|
-
constructor(config2 = {}, isSDK =
|
|
305030
|
+
constructor(config2 = {}, isSDK = true) {
|
|
305042
305031
|
this.cleanupIntervalId = null;
|
|
305043
|
-
this.isSDKMode = false;
|
|
305044
|
-
this.isSDKMode = isSDK;
|
|
305045
305032
|
this.config = { ...isSDK ? SDK_DEFAULT_CONFIG : DEFAULT_CONFIG, ...config2 };
|
|
305046
305033
|
this.initialize();
|
|
305047
305034
|
}
|
|
@@ -305052,38 +305039,6 @@ class LoggerManager {
|
|
|
305052
305039
|
if (!window.log) {
|
|
305053
305040
|
window.log = [];
|
|
305054
305041
|
}
|
|
305055
|
-
if (this.config.autoCleanupInterval && this.config.autoCleanupInterval > 0) {
|
|
305056
|
-
this.startAutoCleanup();
|
|
305057
|
-
}
|
|
305058
|
-
}
|
|
305059
|
-
/**
|
|
305060
|
-
* 开始自动清理
|
|
305061
|
-
*/
|
|
305062
|
-
startAutoCleanup() {
|
|
305063
|
-
if (this.cleanupIntervalId) {
|
|
305064
|
-
clearInterval(this.cleanupIntervalId);
|
|
305065
|
-
}
|
|
305066
|
-
this.cleanupIntervalId = setInterval(() => {
|
|
305067
|
-
this.performCleanup();
|
|
305068
|
-
}, this.config.autoCleanupInterval);
|
|
305069
|
-
}
|
|
305070
|
-
/**
|
|
305071
|
-
* 执行日志清理
|
|
305072
|
-
*/
|
|
305073
|
-
performCleanup() {
|
|
305074
|
-
const logs = window.log;
|
|
305075
|
-
if (!logs || logs.length === 0)
|
|
305076
|
-
return;
|
|
305077
|
-
const originalLogs = logs.length;
|
|
305078
|
-
let cleanedCount = 0;
|
|
305079
|
-
if (logs.length > this.config.cleanupThreshold) {
|
|
305080
|
-
cleanedCount = this.cleanupLogs(this.config.retainSize);
|
|
305081
|
-
} else if (logs.length > this.config.maxSize) {
|
|
305082
|
-
cleanedCount = this.cleanupLogs(this.config.maxSize);
|
|
305083
|
-
}
|
|
305084
|
-
if (cleanedCount > 0 && this.config.logToConsole) {
|
|
305085
|
-
console.log(`[Logger] ${originalLogs} -> ${logs.length} 条 (清理 ${cleanedCount} 条)`);
|
|
305086
|
-
}
|
|
305087
305042
|
}
|
|
305088
305043
|
/**
|
|
305089
305044
|
* 检查是否应该记录此级别日志
|
|
@@ -305118,8 +305073,8 @@ class LoggerManager {
|
|
|
305118
305073
|
return levelOrder[level] >= levelOrder[this.config.levelFilter];
|
|
305119
305074
|
}
|
|
305120
305075
|
/**
|
|
305121
|
-
|
|
305122
|
-
|
|
305076
|
+
* 核心日志记录方法
|
|
305077
|
+
*/
|
|
305123
305078
|
logInternal(data2) {
|
|
305124
305079
|
if (!this.shouldLog(
|
|
305125
305080
|
data2.level || "info"
|
|
@@ -305165,7 +305120,9 @@ class LoggerManager {
|
|
|
305165
305120
|
return;
|
|
305166
305121
|
const safetyThreshold = this.config.maxSize * 1.5;
|
|
305167
305122
|
if (logs.length > safetyThreshold) {
|
|
305168
|
-
console.warn(
|
|
305123
|
+
console.warn(
|
|
305124
|
+
`[Logger] 内存安全警告:日志量(${logs.length})超过安全阈值(${safetyThreshold}),紧急清理`
|
|
305125
|
+
);
|
|
305169
305126
|
this.cleanupLogs(this.config.maxSize);
|
|
305170
305127
|
}
|
|
305171
305128
|
}
|
|
@@ -305298,21 +305255,6 @@ class LoggerManager {
|
|
|
305298
305255
|
}
|
|
305299
305256
|
}
|
|
305300
305257
|
}
|
|
305301
|
-
/**
|
|
305302
|
-
* 更新配置
|
|
305303
|
-
*/
|
|
305304
|
-
updateConfig(newConfig) {
|
|
305305
|
-
const oldAutoCleanup = this.config.autoCleanupInterval;
|
|
305306
|
-
this.config = { ...this.config, ...newConfig };
|
|
305307
|
-
if (newConfig.autoCleanupInterval !== void 0 && newConfig.autoCleanupInterval !== oldAutoCleanup) {
|
|
305308
|
-
if (this.cleanupIntervalId) {
|
|
305309
|
-
clearInterval(this.cleanupIntervalId);
|
|
305310
|
-
}
|
|
305311
|
-
if (this.config.autoCleanupInterval && this.config.autoCleanupInterval > 0) {
|
|
305312
|
-
this.startAutoCleanup();
|
|
305313
|
-
}
|
|
305314
|
-
}
|
|
305315
|
-
}
|
|
305316
305258
|
/**
|
|
305317
305259
|
* 销毁资源
|
|
305318
305260
|
*/
|
|
@@ -305321,10 +305263,6 @@ class LoggerManager {
|
|
|
305321
305263
|
clearInterval(this.cleanupIntervalId);
|
|
305322
305264
|
this.cleanupIntervalId = null;
|
|
305323
305265
|
}
|
|
305324
|
-
if (typeof window !== "undefined" && this.isSDKMode) {
|
|
305325
|
-
delete window.__CALL_SDK__;
|
|
305326
|
-
delete window.__GUEST_SDK__;
|
|
305327
|
-
}
|
|
305328
305266
|
}
|
|
305329
305267
|
/**
|
|
305330
305268
|
* SDK专用:导出日志数据(用于诊断和调试)
|
|
@@ -305356,7 +305294,7 @@ class LoggerManager {
|
|
|
305356
305294
|
return { total: logs.length, errors, warnings };
|
|
305357
305295
|
}
|
|
305358
305296
|
}
|
|
305359
|
-
const logger = new LoggerManager({}
|
|
305297
|
+
const logger = new LoggerManager({});
|
|
305360
305298
|
const UserVideoContainer = reactExports.memo(({
|
|
305361
305299
|
user,
|
|
305362
305300
|
isSelected = false,
|
|
@@ -305417,7 +305355,7 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305417
305355
|
noMirror,
|
|
305418
305356
|
shouldMirror: +!noMirror
|
|
305419
305357
|
});
|
|
305420
|
-
const isModeFit = user.rtc_userid === callConfig.drawing_board_id || (videoId == null ? void 0 : videoId.includes("screen")) || user.device === "pc" || videoId.includes("self");
|
|
305358
|
+
const isModeFit = user.rtc_userid === callConfig.drawing_board_id || (videoId == null ? void 0 : videoId.includes("screen")) || user.device === "pc" || !videoId.includes("self");
|
|
305421
305359
|
if (user.rtc_userid === callConfig.rtc_userid) {
|
|
305422
305360
|
rtc.engine.setLocalVideoPlayer((videoId == null ? void 0 : videoId.includes("screen")) ? StreamIndex$1.STREAM_INDEX_SCREEN : StreamIndex$1.STREAM_INDEX_MAIN, {
|
|
305423
305361
|
userId: user.rtc_userid,
|
|
@@ -305474,7 +305412,7 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305474
305412
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
305475
305413
|
className: "w-full h-full bg-gray-800 flex items-center justify-center",
|
|
305476
305414
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
305477
|
-
className: "h-full text-gray-400 text-sm",
|
|
305415
|
+
className: "h-full w-full text-gray-400 text-sm",
|
|
305478
305416
|
id: videoId
|
|
305479
305417
|
})
|
|
305480
305418
|
}), !hasVideo && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|