call-live-sdk1 0.0.34 → 0.0.36
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 +533 -69
- 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 +136 -0
- package/dist/utils/utiles.d.ts +19 -0
- package/package.json +1 -1
- package/dist/components/EnvExample.d.ts +0 -7
package/dist/call-live-sdk.es.js
CHANGED
|
@@ -28814,7 +28814,7 @@ function removeSign(options = {}) {
|
|
|
28814
28814
|
localStorage.removeItem(storageKey);
|
|
28815
28815
|
}
|
|
28816
28816
|
const isMobile$3 = (() => {
|
|
28817
|
-
const mobileRegex =
|
|
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;
|
|
@@ -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
|
}
|
|
@@ -188594,6 +188598,16 @@ const subscribeWithSelectorImpl = (fn2) => (set3, get4, api) => {
|
|
|
188594
188598
|
return initialState;
|
|
188595
188599
|
};
|
|
188596
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
|
+
}));
|
|
188597
188611
|
var VideoType = /* @__PURE__ */ ((VideoType2) => {
|
|
188598
188612
|
VideoType2["CAMERA"] = "video";
|
|
188599
188613
|
VideoType2["SCREEN"] = "screen";
|
|
@@ -188613,16 +188627,6 @@ var LayoutMode = /* @__PURE__ */ ((LayoutMode2) => {
|
|
|
188613
188627
|
LayoutMode2["GRID"] = "grid";
|
|
188614
188628
|
return LayoutMode2;
|
|
188615
188629
|
})(LayoutMode || {});
|
|
188616
|
-
const useGuestStore = create$c()((set3, get4) => ({
|
|
188617
|
-
status: 0,
|
|
188618
|
-
deviceType: "pc",
|
|
188619
|
-
setDeviceType: (deviceType) => {
|
|
188620
|
-
set3({ deviceType });
|
|
188621
|
-
},
|
|
188622
|
-
setStatus: (status) => {
|
|
188623
|
-
set3({ status });
|
|
188624
|
-
}
|
|
188625
|
-
}));
|
|
188626
188630
|
const updateRTCStorageConfig = async (params) => {
|
|
188627
188631
|
return request("/bis/rtc/storage/config", {
|
|
188628
188632
|
method: "POST",
|
|
@@ -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":
|
|
@@ -303911,8 +303915,10 @@ const WebLiveLogin = () => {
|
|
|
303911
303915
|
};
|
|
303912
303916
|
}, [handleLogin]);
|
|
303913
303917
|
reactExports.useEffect(() => {
|
|
303914
|
-
window.log
|
|
303915
|
-
|
|
303918
|
+
if (!window.log) {
|
|
303919
|
+
window.log = [];
|
|
303920
|
+
}
|
|
303921
|
+
}, []);
|
|
303916
303922
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
303917
303923
|
className: "web-live-login-container",
|
|
303918
303924
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
@@ -304988,6 +304994,369 @@ const PageIndicator = reactExports.memo(
|
|
|
304988
304994
|
}
|
|
304989
304995
|
);
|
|
304990
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
|
+
};
|
|
305012
|
+
const DEFAULT_CONFIG = {
|
|
305013
|
+
enabled: false,
|
|
305014
|
+
// 开发环境默认启用
|
|
305015
|
+
maxSize: 1e3,
|
|
305016
|
+
// 最大缓存条目数量
|
|
305017
|
+
cleanupThreshold: 1200,
|
|
305018
|
+
// 触发清理的阈值
|
|
305019
|
+
retainSize: 800,
|
|
305020
|
+
// 清理后保留的条目数量
|
|
305021
|
+
autoCleanupInterval: 6e4,
|
|
305022
|
+
// 自动清理间隔时间(毫秒)
|
|
305023
|
+
logToConsole: true,
|
|
305024
|
+
// 是否输出日志到控制台
|
|
305025
|
+
levelFilter: "debug"
|
|
305026
|
+
/* DEBUG */
|
|
305027
|
+
// 日志级别过滤
|
|
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
|
+
class LoggerManager {
|
|
305041
|
+
constructor(config2 = {}, isSDK = false) {
|
|
305042
|
+
this.cleanupIntervalId = null;
|
|
305043
|
+
this.isSDKMode = false;
|
|
305044
|
+
this.isSDKMode = isSDK;
|
|
305045
|
+
this.config = { ...isSDK ? SDK_DEFAULT_CONFIG : DEFAULT_CONFIG, ...config2 };
|
|
305046
|
+
this.initialize();
|
|
305047
|
+
}
|
|
305048
|
+
/**
|
|
305049
|
+
* 初始化日志管理器
|
|
305050
|
+
*/
|
|
305051
|
+
initialize() {
|
|
305052
|
+
if (!window.log) {
|
|
305053
|
+
window.log = [];
|
|
305054
|
+
}
|
|
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
|
+
}
|
|
305088
|
+
/**
|
|
305089
|
+
* 检查是否应该记录此级别日志
|
|
305090
|
+
*/
|
|
305091
|
+
shouldLog(level) {
|
|
305092
|
+
if (!this.config.enabled)
|
|
305093
|
+
return false;
|
|
305094
|
+
if (!this.config.levelFilter)
|
|
305095
|
+
return true;
|
|
305096
|
+
const levelOrder = {
|
|
305097
|
+
[
|
|
305098
|
+
"debug"
|
|
305099
|
+
/* DEBUG */
|
|
305100
|
+
]: 0,
|
|
305101
|
+
[
|
|
305102
|
+
"info"
|
|
305103
|
+
/* INFO */
|
|
305104
|
+
]: 1,
|
|
305105
|
+
[
|
|
305106
|
+
"warn"
|
|
305107
|
+
/* WARN */
|
|
305108
|
+
]: 2,
|
|
305109
|
+
[
|
|
305110
|
+
"error"
|
|
305111
|
+
/* ERROR */
|
|
305112
|
+
]: 3,
|
|
305113
|
+
[
|
|
305114
|
+
"critical"
|
|
305115
|
+
/* CRITICAL */
|
|
305116
|
+
]: 4
|
|
305117
|
+
};
|
|
305118
|
+
return levelOrder[level] >= levelOrder[this.config.levelFilter];
|
|
305119
|
+
}
|
|
305120
|
+
/**
|
|
305121
|
+
* 核心日志记录方法
|
|
305122
|
+
*/
|
|
305123
|
+
logInternal(data2) {
|
|
305124
|
+
if (!this.shouldLog(
|
|
305125
|
+
data2.level || "info"
|
|
305126
|
+
/* INFO */
|
|
305127
|
+
))
|
|
305128
|
+
return;
|
|
305129
|
+
if (!window.log) {
|
|
305130
|
+
window.log = [];
|
|
305131
|
+
}
|
|
305132
|
+
const logEntry = {
|
|
305133
|
+
timestamp: Date.now(),
|
|
305134
|
+
level: data2.level || "info",
|
|
305135
|
+
...data2
|
|
305136
|
+
};
|
|
305137
|
+
window.log.push(logEntry);
|
|
305138
|
+
this.cleanupIfNeeded();
|
|
305139
|
+
if (this.config.logToConsole) {
|
|
305140
|
+
const prefix2 = `[${logEntry.component}] ${logEntry.event}`;
|
|
305141
|
+
const message2 = typeof logEntry.content === "string" ? logEntry.content : JSON.stringify(logEntry.content);
|
|
305142
|
+
switch (logEntry.level) {
|
|
305143
|
+
case "error":
|
|
305144
|
+
case "critical":
|
|
305145
|
+
console.error(`${prefix2}: ${message2}`, logEntry.extra);
|
|
305146
|
+
break;
|
|
305147
|
+
case "warn":
|
|
305148
|
+
console.warn(`${prefix2}: ${message2}`, logEntry.extra);
|
|
305149
|
+
break;
|
|
305150
|
+
case "info":
|
|
305151
|
+
console.info(`${prefix2}: ${message2}`, logEntry.extra);
|
|
305152
|
+
break;
|
|
305153
|
+
default:
|
|
305154
|
+
console.debug(`${prefix2}: ${message2}`, logEntry.extra);
|
|
305155
|
+
}
|
|
305156
|
+
}
|
|
305157
|
+
}
|
|
305158
|
+
/**
|
|
305159
|
+
* 检查并清理超出的日志(安全检查,确保内存安全)
|
|
305160
|
+
* 方案2优化:使用两级阈值检测
|
|
305161
|
+
*/
|
|
305162
|
+
cleanupIfNeeded() {
|
|
305163
|
+
const logs = window.log;
|
|
305164
|
+
if (!logs || logs.length === 0)
|
|
305165
|
+
return;
|
|
305166
|
+
const safetyThreshold = this.config.maxSize * 1.5;
|
|
305167
|
+
if (logs.length > safetyThreshold) {
|
|
305168
|
+
console.warn(`[Logger] 内存安全警告:日志量(${logs.length})超过安全阈值(${safetyThreshold}),紧急清理`);
|
|
305169
|
+
this.cleanupLogs(this.config.maxSize);
|
|
305170
|
+
}
|
|
305171
|
+
}
|
|
305172
|
+
/**
|
|
305173
|
+
* 公共方法:记录调试日志
|
|
305174
|
+
*/
|
|
305175
|
+
debug(data2) {
|
|
305176
|
+
this.logInternal({
|
|
305177
|
+
...data2,
|
|
305178
|
+
level: "debug"
|
|
305179
|
+
/* DEBUG */
|
|
305180
|
+
});
|
|
305181
|
+
}
|
|
305182
|
+
/**
|
|
305183
|
+
* 公共方法:记录信息日志
|
|
305184
|
+
*/
|
|
305185
|
+
info(data2) {
|
|
305186
|
+
this.logInternal({
|
|
305187
|
+
...data2,
|
|
305188
|
+
level: "info"
|
|
305189
|
+
/* INFO */
|
|
305190
|
+
});
|
|
305191
|
+
}
|
|
305192
|
+
/**
|
|
305193
|
+
* 公共方法:记录警告日志
|
|
305194
|
+
*/
|
|
305195
|
+
warn(data2) {
|
|
305196
|
+
this.logInternal({
|
|
305197
|
+
...data2,
|
|
305198
|
+
level: "warn"
|
|
305199
|
+
/* WARN */
|
|
305200
|
+
});
|
|
305201
|
+
}
|
|
305202
|
+
/**
|
|
305203
|
+
* 公共方法:记录错误日志
|
|
305204
|
+
*/
|
|
305205
|
+
error(data2) {
|
|
305206
|
+
this.logInternal({
|
|
305207
|
+
...data2,
|
|
305208
|
+
level: "error"
|
|
305209
|
+
/* ERROR */
|
|
305210
|
+
});
|
|
305211
|
+
}
|
|
305212
|
+
/**
|
|
305213
|
+
* 公共方法:记录关键错误日志
|
|
305214
|
+
*/
|
|
305215
|
+
critical(data2) {
|
|
305216
|
+
this.logInternal({
|
|
305217
|
+
...data2,
|
|
305218
|
+
level: "critical"
|
|
305219
|
+
/* CRITICAL */
|
|
305220
|
+
});
|
|
305221
|
+
}
|
|
305222
|
+
/**
|
|
305223
|
+
* 手动清理日志
|
|
305224
|
+
*/
|
|
305225
|
+
cleanupLogs(retainCount = this.config.retainSize) {
|
|
305226
|
+
if (!window.log || window.log.length <= retainCount) {
|
|
305227
|
+
return 0;
|
|
305228
|
+
}
|
|
305229
|
+
const beforeLength = window.log.length;
|
|
305230
|
+
window.log = window.log.slice(-retainCount);
|
|
305231
|
+
return beforeLength - window.log.length;
|
|
305232
|
+
}
|
|
305233
|
+
/**
|
|
305234
|
+
* 获取日志统计信息
|
|
305235
|
+
*/
|
|
305236
|
+
getStats() {
|
|
305237
|
+
if (!window.log)
|
|
305238
|
+
return null;
|
|
305239
|
+
const logs = window.log;
|
|
305240
|
+
const byLevel = {
|
|
305241
|
+
[
|
|
305242
|
+
"debug"
|
|
305243
|
+
/* DEBUG */
|
|
305244
|
+
]: 0,
|
|
305245
|
+
[
|
|
305246
|
+
"info"
|
|
305247
|
+
/* INFO */
|
|
305248
|
+
]: 0,
|
|
305249
|
+
[
|
|
305250
|
+
"warn"
|
|
305251
|
+
/* WARN */
|
|
305252
|
+
]: 0,
|
|
305253
|
+
[
|
|
305254
|
+
"error"
|
|
305255
|
+
/* ERROR */
|
|
305256
|
+
]: 0,
|
|
305257
|
+
[
|
|
305258
|
+
"critical"
|
|
305259
|
+
/* CRITICAL */
|
|
305260
|
+
]: 0
|
|
305261
|
+
};
|
|
305262
|
+
logs.forEach((log2) => {
|
|
305263
|
+
const level = log2.level || "info";
|
|
305264
|
+
byLevel[level] = (byLevel[level] || 0) + 1;
|
|
305265
|
+
});
|
|
305266
|
+
const memoryEstimate = this.estimateMemoryUsage(logs);
|
|
305267
|
+
return {
|
|
305268
|
+
total: logs.length,
|
|
305269
|
+
byLevel,
|
|
305270
|
+
memoryEstimate
|
|
305271
|
+
};
|
|
305272
|
+
}
|
|
305273
|
+
/**
|
|
305274
|
+
* 估算日志内存占用
|
|
305275
|
+
*/
|
|
305276
|
+
estimateMemoryUsage(logs) {
|
|
305277
|
+
if (!logs || logs.length === 0)
|
|
305278
|
+
return "0KB";
|
|
305279
|
+
const avgSize = 350;
|
|
305280
|
+
const totalBytes = logs.length * avgSize;
|
|
305281
|
+
if (totalBytes < 1024) {
|
|
305282
|
+
return `${totalBytes}B`;
|
|
305283
|
+
} else if (totalBytes < 1024 * 1024) {
|
|
305284
|
+
return `${(totalBytes / 1024).toFixed(2)}KB`;
|
|
305285
|
+
} else {
|
|
305286
|
+
return `${(totalBytes / (1024 * 1024)).toFixed(2)}MB`;
|
|
305287
|
+
}
|
|
305288
|
+
}
|
|
305289
|
+
/**
|
|
305290
|
+
* 清除所有日志
|
|
305291
|
+
*/
|
|
305292
|
+
clearLogs() {
|
|
305293
|
+
if (window.log) {
|
|
305294
|
+
const length2 = window.log.length;
|
|
305295
|
+
window.log = [];
|
|
305296
|
+
if (this.config.logToConsole) {
|
|
305297
|
+
console.log(`[Logger] 清除所有日志,共 ${length2} 条`);
|
|
305298
|
+
}
|
|
305299
|
+
}
|
|
305300
|
+
}
|
|
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
|
+
/**
|
|
305317
|
+
* 销毁资源
|
|
305318
|
+
*/
|
|
305319
|
+
destroy() {
|
|
305320
|
+
if (this.cleanupIntervalId) {
|
|
305321
|
+
clearInterval(this.cleanupIntervalId);
|
|
305322
|
+
this.cleanupIntervalId = null;
|
|
305323
|
+
}
|
|
305324
|
+
if (typeof window !== "undefined" && this.isSDKMode) {
|
|
305325
|
+
delete window.__CALL_SDK__;
|
|
305326
|
+
delete window.__GUEST_SDK__;
|
|
305327
|
+
}
|
|
305328
|
+
}
|
|
305329
|
+
/**
|
|
305330
|
+
* SDK专用:导出日志数据(用于诊断和调试)
|
|
305331
|
+
*/
|
|
305332
|
+
exportLogs(count2 = 100) {
|
|
305333
|
+
if (!window.log)
|
|
305334
|
+
return [];
|
|
305335
|
+
const logs = window.log;
|
|
305336
|
+
return logs.slice(-count2).map((log2, index2) => ({
|
|
305337
|
+
...log2,
|
|
305338
|
+
index: logs.length - count2 + index2
|
|
305339
|
+
}));
|
|
305340
|
+
}
|
|
305341
|
+
/**
|
|
305342
|
+
* SDK专用:获取SDK环境下的日志统计
|
|
305343
|
+
*/
|
|
305344
|
+
getSDKStats() {
|
|
305345
|
+
if (!window.log)
|
|
305346
|
+
return { total: 0, errors: 0, warnings: 0 };
|
|
305347
|
+
const logs = window.log;
|
|
305348
|
+
const errors = logs.filter(
|
|
305349
|
+
(log2) => log2.level === "error" || log2.level === "critical"
|
|
305350
|
+
/* CRITICAL */
|
|
305351
|
+
).length;
|
|
305352
|
+
const warnings = logs.filter(
|
|
305353
|
+
(log2) => log2.level === "warn"
|
|
305354
|
+
/* WARN */
|
|
305355
|
+
).length;
|
|
305356
|
+
return { total: logs.length, errors, warnings };
|
|
305357
|
+
}
|
|
305358
|
+
}
|
|
305359
|
+
const logger = new LoggerManager({}, isSDKEnvironment());
|
|
304991
305360
|
const UserVideoContainer = reactExports.memo(({
|
|
304992
305361
|
user,
|
|
304993
305362
|
isSelected = false,
|
|
@@ -304995,11 +305364,6 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
304995
305364
|
className = "",
|
|
304996
305365
|
videoId = ""
|
|
304997
305366
|
}) => {
|
|
304998
|
-
window.log.push({
|
|
304999
|
-
com: "UserVideoContainer",
|
|
305000
|
-
event: "UserVideoContainer mounted",
|
|
305001
|
-
content: "进入UserVideoContainer组件"
|
|
305002
|
-
});
|
|
305003
305367
|
const {
|
|
305004
305368
|
rtc,
|
|
305005
305369
|
callConfig
|
|
@@ -305054,15 +305418,6 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305054
305418
|
shouldMirror: +!noMirror
|
|
305055
305419
|
});
|
|
305056
305420
|
const isModeFit = user.rtc_userid === callConfig.drawing_board_id || (videoId == null ? void 0 : videoId.includes("screen")) || user.device === "pc" || videoId.includes("self");
|
|
305057
|
-
window.log.push({
|
|
305058
|
-
com: "UserVideoContainer",
|
|
305059
|
-
params: {
|
|
305060
|
-
user,
|
|
305061
|
-
videoId
|
|
305062
|
-
},
|
|
305063
|
-
event: "isModeFit",
|
|
305064
|
-
content: `isModeFit ${isModeFit}`
|
|
305065
|
-
});
|
|
305066
305421
|
if (user.rtc_userid === callConfig.rtc_userid) {
|
|
305067
305422
|
rtc.engine.setLocalVideoPlayer((videoId == null ? void 0 : videoId.includes("screen")) ? StreamIndex$1.STREAM_INDEX_SCREEN : StreamIndex$1.STREAM_INDEX_MAIN, {
|
|
305068
305423
|
userId: user.rtc_userid,
|
|
@@ -305080,19 +305435,17 @@ const UserVideoContainer = reactExports.memo(({
|
|
|
305080
305435
|
});
|
|
305081
305436
|
rtc == null ? void 0 : rtc.engine.setRemoteVideoMirrorType(user.rtc_userid, StreamIndex$1.STREAM_INDEX_MAIN, +!noMirror);
|
|
305082
305437
|
}
|
|
305083
|
-
|
|
305084
|
-
|
|
305085
|
-
|
|
305086
|
-
|
|
305087
|
-
|
|
305088
|
-
|
|
305089
|
-
|
|
305090
|
-
|
|
305091
|
-
|
|
305092
|
-
|
|
305093
|
-
}
|
|
305094
|
-
event: "setVideoPlayer",
|
|
305095
|
-
content: `设置视频播放器 ${videoId}`
|
|
305438
|
+
logger.info({
|
|
305439
|
+
component: "UserVideoContainer",
|
|
305440
|
+
event: "video_player_setup",
|
|
305441
|
+
content: `设置视频播放器 ${videoId}`,
|
|
305442
|
+
extra: {
|
|
305443
|
+
userId: user.rtc_userid,
|
|
305444
|
+
videoId,
|
|
305445
|
+
isSelf: user.rtc_userid === callConfig.rtc_userid,
|
|
305446
|
+
streamIndex: (videoId == null ? void 0 : videoId.includes("screen")) ? "STREAM_INDEX_SCREEN" : "STREAM_INDEX_MAIN",
|
|
305447
|
+
renderMode: isModeFit ? "RENDER_MODE_FIT" : "RENDER_MODE_HIDDEN"
|
|
305448
|
+
}
|
|
305096
305449
|
});
|
|
305097
305450
|
return () => {
|
|
305098
305451
|
if (user.rtc_userid === callConfig.rtc_userid) {
|
|
@@ -305774,11 +306127,6 @@ const LiveWaitingRoom = ({
|
|
|
305774
306127
|
const MobileLive = reactExports.memo(({
|
|
305775
306128
|
className = ""
|
|
305776
306129
|
}) => {
|
|
305777
|
-
window.log.push({
|
|
305778
|
-
com: "MobileLive",
|
|
305779
|
-
event: "MobileLive mounted",
|
|
305780
|
-
content: "进入MobileLive组件"
|
|
305781
|
-
});
|
|
305782
306130
|
const {
|
|
305783
306131
|
layoutMode,
|
|
305784
306132
|
rtc,
|
|
@@ -305909,6 +306257,17 @@ const MobileLive = reactExports.memo(({
|
|
|
305909
306257
|
window.callConfig = callConfig;
|
|
305910
306258
|
window.rtc = rtc;
|
|
305911
306259
|
}, [callUsers, callConfig, rtc]);
|
|
306260
|
+
reactExports.useEffect(() => {
|
|
306261
|
+
logger.info({
|
|
306262
|
+
component: "MobileLive",
|
|
306263
|
+
event: "component_mounted",
|
|
306264
|
+
content: "进入MobileLive组件",
|
|
306265
|
+
extra: {
|
|
306266
|
+
userAgent: navigator.userAgent,
|
|
306267
|
+
isMobile: isMobile$3
|
|
306268
|
+
}
|
|
306269
|
+
});
|
|
306270
|
+
}, []);
|
|
305912
306271
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ConfigProvider$1, {
|
|
305913
306272
|
theme: {
|
|
305914
306273
|
algorithm: theme.darkAlgorithm,
|
|
@@ -306049,6 +306408,7 @@ class CallLiveSdk {
|
|
|
306049
306408
|
}
|
|
306050
306409
|
});
|
|
306051
306410
|
this.config = config2;
|
|
306411
|
+
this.initSDKLogger();
|
|
306052
306412
|
useSdkStore.setState({
|
|
306053
306413
|
callConfig: this.config
|
|
306054
306414
|
});
|
|
@@ -306121,6 +306481,49 @@ class CallLiveSdk {
|
|
|
306121
306481
|
this.root.unmount();
|
|
306122
306482
|
this.root = null;
|
|
306123
306483
|
}
|
|
306484
|
+
logger.info({
|
|
306485
|
+
component: "CallLiveSdk",
|
|
306486
|
+
event: "sdk_destroyed",
|
|
306487
|
+
content: "SDK已销毁并清理资源",
|
|
306488
|
+
extra: {
|
|
306489
|
+
liveId: this.config.liveId
|
|
306490
|
+
}
|
|
306491
|
+
});
|
|
306492
|
+
}
|
|
306493
|
+
/**
|
|
306494
|
+
* 初始化SDK日志系统
|
|
306495
|
+
*/
|
|
306496
|
+
initSDKLogger() {
|
|
306497
|
+
window.__CALL_SDK__ = true;
|
|
306498
|
+
if (!window.log) {
|
|
306499
|
+
window.log = [];
|
|
306500
|
+
}
|
|
306501
|
+
logger.info({
|
|
306502
|
+
component: "CallLiveSdk",
|
|
306503
|
+
event: "sdk_initialized",
|
|
306504
|
+
content: "CallLiveSdk初始化完成",
|
|
306505
|
+
extra: {
|
|
306506
|
+
liveId: this.config.liveId,
|
|
306507
|
+
agentId: this.config.agentId,
|
|
306508
|
+
sdkVersion: "v1.0.0"
|
|
306509
|
+
// TODO: 从package.json获取
|
|
306510
|
+
}
|
|
306511
|
+
});
|
|
306512
|
+
window.addEventListener("error", (event) => {
|
|
306513
|
+
var _a2;
|
|
306514
|
+
logger.error({
|
|
306515
|
+
component: "SDK Error",
|
|
306516
|
+
event: "window_error",
|
|
306517
|
+
content: "捕获到window错误",
|
|
306518
|
+
extra: {
|
|
306519
|
+
message: event.message,
|
|
306520
|
+
filename: event.filename,
|
|
306521
|
+
lineno: event.lineno,
|
|
306522
|
+
colno: event.colno,
|
|
306523
|
+
error: (_a2 = event.error) == null ? void 0 : _a2.toString()
|
|
306524
|
+
}
|
|
306525
|
+
});
|
|
306526
|
+
});
|
|
306124
306527
|
}
|
|
306125
306528
|
}
|
|
306126
306529
|
class GuestCallSdk {
|
|
@@ -306132,6 +306535,7 @@ class GuestCallSdk {
|
|
|
306132
306535
|
}
|
|
306133
306536
|
});
|
|
306134
306537
|
this.config = config2;
|
|
306538
|
+
this.initSDKLogger();
|
|
306135
306539
|
useSdkStore.setState({
|
|
306136
306540
|
guestConfig: config2
|
|
306137
306541
|
});
|
|
@@ -306172,6 +306576,66 @@ class GuestCallSdk {
|
|
|
306172
306576
|
})
|
|
306173
306577
|
}));
|
|
306174
306578
|
}
|
|
306579
|
+
/**
|
|
306580
|
+
* 获取当前配置
|
|
306581
|
+
*/
|
|
306582
|
+
getConfig() {
|
|
306583
|
+
return {
|
|
306584
|
+
...this.config
|
|
306585
|
+
};
|
|
306586
|
+
}
|
|
306587
|
+
/**
|
|
306588
|
+
* 销毁SDK
|
|
306589
|
+
*/
|
|
306590
|
+
destroy() {
|
|
306591
|
+
if (this.root) {
|
|
306592
|
+
this.root.unmount();
|
|
306593
|
+
this.root = null;
|
|
306594
|
+
}
|
|
306595
|
+
logger.info({
|
|
306596
|
+
component: "GuestCallSdk",
|
|
306597
|
+
event: "sdk_destroyed",
|
|
306598
|
+
content: "Guest SDK已销毁并清理资源",
|
|
306599
|
+
extra: {
|
|
306600
|
+
liveId: this.config.liveId
|
|
306601
|
+
}
|
|
306602
|
+
});
|
|
306603
|
+
}
|
|
306604
|
+
/**
|
|
306605
|
+
* 初始化SDK日志系统
|
|
306606
|
+
*/
|
|
306607
|
+
initSDKLogger() {
|
|
306608
|
+
window.__GUEST_SDK__ = true;
|
|
306609
|
+
if (!window.log) {
|
|
306610
|
+
window.log = [];
|
|
306611
|
+
}
|
|
306612
|
+
logger.info({
|
|
306613
|
+
component: "GuestCallSdk",
|
|
306614
|
+
event: "sdk_initialized",
|
|
306615
|
+
content: "GuestCallSdk初始化完成",
|
|
306616
|
+
extra: {
|
|
306617
|
+
liveId: this.config.liveId,
|
|
306618
|
+
agentId: this.config.agentId,
|
|
306619
|
+
sdkVersion: "v1.0.0"
|
|
306620
|
+
// TODO: 从package.json获取
|
|
306621
|
+
}
|
|
306622
|
+
});
|
|
306623
|
+
window.addEventListener("error", (event) => {
|
|
306624
|
+
var _a2;
|
|
306625
|
+
logger.error({
|
|
306626
|
+
component: "SDK Error",
|
|
306627
|
+
event: "window_error",
|
|
306628
|
+
content: "捕获到window错误",
|
|
306629
|
+
extra: {
|
|
306630
|
+
message: event.message,
|
|
306631
|
+
filename: event.filename,
|
|
306632
|
+
lineno: event.lineno,
|
|
306633
|
+
colno: event.colno,
|
|
306634
|
+
error: (_a2 = event.error) == null ? void 0 : _a2.toString()
|
|
306635
|
+
}
|
|
306636
|
+
});
|
|
306637
|
+
});
|
|
306638
|
+
}
|
|
306175
306639
|
}
|
|
306176
306640
|
export {
|
|
306177
306641
|
CallLiveSdk,
|