@realsee/live 0.6.10 → 0.6.11-dev.2

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/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var Vt = Object.defineProperty;
2
- var $t = (r, s, e) => s in r ? Vt(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
- var o = (r, s, e) => ($t(r, typeof s != "symbol" ? s + "" : s, e), e);
2
+ var $t = (r, o, e) => o in r ? Vt(r, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[o] = e;
3
+ var s = (r, o, e) => ($t(r, typeof o != "symbol" ? o + "" : o, e), e);
4
4
  import xt from "@realsee/jsbridge-x";
5
5
  import Ne from "trtc-js-sdk";
6
6
  import { ConsoleLogger as Ut, LogLevel as Ft, DefaultDeviceController as Bt, MeetingSessionConfiguration as Wt, DefaultMeetingSession as Kt, DefaultModality as tt, MeetingSessionStatusCode as qt } from "amazon-chime-sdk-js";
@@ -17,9 +17,9 @@ class ue {
17
17
  * 判断是否注册了事件
18
18
  * @param name 事件类型
19
19
  */
20
- hasListener(s) {
20
+ hasListener(o) {
21
21
  const e = pe(this);
22
- return e && e[s] && e[s].length > 0;
22
+ return e && e[o] && e[o].length > 0;
23
23
  }
24
24
  /**
25
25
  * 注册事件
@@ -30,9 +30,9 @@ class ue {
30
30
  * @template K 预设的监听事件名称
31
31
  * @template C 回调函数函数上下文
32
32
  */
33
- on(s, e, i) {
33
+ on(o, e, i) {
34
34
  const n = pe(this);
35
- return n[s] || (n[s] = []), n[s].push([e, i || !1]), () => this.off(s, e);
35
+ return n[o] || (n[o] = []), n[o].push([e, i || !1]), () => this.off(o, e);
36
36
  }
37
37
  /**
38
38
  * 注册事件(是否只执行一次)
@@ -42,8 +42,8 @@ class ue {
42
42
  * @template K 预设的监听事件名称
43
43
  * @template C 回调函数函数上下文
44
44
  */
45
- once(s, e) {
46
- return this.on(s, e, !0);
45
+ once(o, e) {
46
+ return this.on(o, e, !0);
47
47
  }
48
48
  /**
49
49
  * 解除事件
@@ -54,20 +54,20 @@ class ue {
54
54
  * @param callback 事件回调函数
55
55
  * @template K 预设的监听事件名称
56
56
  */
57
- off(s, e) {
58
- if (s === void 0) {
57
+ off(o, e) {
58
+ if (o === void 0) {
59
59
  Yt(this);
60
60
  return;
61
61
  }
62
62
  const i = pe(this);
63
- if (i[s] || (i[s] = []), e === void 0) {
64
- i[s].length = 0;
63
+ if (i[o] || (i[o] = []), e === void 0) {
64
+ i[o].length = 0;
65
65
  return;
66
66
  }
67
67
  let n = 0;
68
- for (; n < i[s].length && i[s][n][0] !== e; n++)
68
+ for (; n < i[o].length && i[o][n][0] !== e; n++)
69
69
  ;
70
- n < i[s].length && i[s].splice(n, 1);
70
+ n < i[o].length && i[o].splice(n, 1);
71
71
  }
72
72
  /**
73
73
  * 触发事件
@@ -76,12 +76,12 @@ class ue {
76
76
  * @returns canceled 是否被触发取消
77
77
  * @template K 预设的监听事件名称
78
78
  */
79
- emit(s, ...e) {
79
+ emit(o, ...e) {
80
80
  let i = !1;
81
- const c = pe(this)[s] || [];
81
+ const c = pe(this)[o] || [];
82
82
  for (let u of c.slice()) {
83
83
  const [d, g = !1] = u, v = d(...e);
84
- g && this.off(s, d), v === !1 && (i = !0);
84
+ g && this.off(o, d), v === !1 && (i = !0);
85
85
  }
86
86
  return i;
87
87
  }
@@ -90,18 +90,18 @@ class Me extends ue {
90
90
  }
91
91
  var Q = /* @__PURE__ */ ((r) => (r.RealseeBrowserRTC = "RealseeBrowserRTC", r.RealseeVRWebViewRTC = "RealseeVRWebViewRTC", r.RealseeBrowserChimeRTC = "RealseeBrowserChimeRTC", r))(Q || {}), ut = /* @__PURE__ */ ((r) => (r.RealseeXTRTC = "trtc", r.RealseeXChimeRTC = "chime", r))(ut || {});
92
92
  const Ht = () => {
93
- const r = new Date(), s = r.getFullYear(), e = (r.getMonth() + 1).toString().padStart(2, "0"), i = r.getDate().toString().padStart(2, "0"), n = r.getHours().toString().padStart(2, "0"), c = r.getMinutes().toString().padStart(2, "0"), u = r.getSeconds().toString().padStart(2, "0"), d = r.getMilliseconds();
94
- return `[${s}-${e}-${i} ${n}:${c}:${u}.${d}]`;
95
- }, be = (r, s = []) => {
96
- switch (s.unshift(`Realsee Live ${Ht()} <${r}> `), r) {
93
+ const r = new Date(), o = r.getFullYear(), e = (r.getMonth() + 1).toString().padStart(2, "0"), i = r.getDate().toString().padStart(2, "0"), n = r.getHours().toString().padStart(2, "0"), c = r.getMinutes().toString().padStart(2, "0"), u = r.getSeconds().toString().padStart(2, "0"), d = r.getMilliseconds();
94
+ return `[${o}-${e}-${i} ${n}:${c}:${u}.${d}]`;
95
+ }, be = (r, o = []) => {
96
+ switch (o.unshift(`Realsee Live ${Ht()} <${r}> `), r) {
97
97
  case "INFO":
98
- return console.info(...s);
98
+ return console.info(...o);
99
99
  case "ERROR":
100
- return console.error(...s);
100
+ return console.error(...o);
101
101
  case "WARN":
102
- return console.warn(...s);
102
+ return console.warn(...o);
103
103
  default:
104
- return console.log(...s);
104
+ return console.log(...o);
105
105
  }
106
106
  }, Jt = (...r) => be("LOG", r), zt = (...r) => be("INFO", r), Xt = (...r) => be("ERROR", r), Zt = (...r) => be("WARN", r), Qt = {
107
107
  log: Jt,
@@ -118,21 +118,21 @@ function Ee() {
118
118
  class rt extends Me {
119
119
  constructor(e) {
120
120
  super();
121
- o(this, "type", Q.RealseeBrowserRTC);
122
- o(this, "joined", !1);
123
- o(this, "micro", !1);
124
- o(this, "voiceId", "");
125
- o(this, "_getVoiceSign", () => {
121
+ s(this, "type", Q.RealseeBrowserRTC);
122
+ s(this, "joined", !1);
123
+ s(this, "micro", !1);
124
+ s(this, "voiceId", "");
125
+ s(this, "_getVoiceSign", () => {
126
126
  throw new Error("方法 getVoiceSign 未实现");
127
127
  });
128
- o(this, "_autoPlayConfirm");
129
- o(this, "checkRequirement", () => Ne.checkSystemRequirements());
130
- o(this, "$dom", document.createElement("div"));
131
- o(this, "_trtc", {
128
+ s(this, "_autoPlayConfirm");
129
+ s(this, "checkRequirement", () => Ne.checkSystemRequirements());
130
+ s(this, "$dom", document.createElement("div"));
131
+ s(this, "_trtc", {
132
132
  client: null,
133
133
  stream: null
134
134
  });
135
- o(this, "join", async (e) => {
135
+ s(this, "join", async (e) => {
136
136
  var c;
137
137
  this.emit("joinWillStart");
138
138
  const i = await this._getVoiceSign({
@@ -161,12 +161,12 @@ class rt extends Me {
161
161
  (d = this._trtc.client) == null || d.publish(this._trtc.stream).then(() => u(!0)).catch(() => u(!1));
162
162
  }), this.joined = n, this.joined && this.emit("joined"), n) : !1;
163
163
  });
164
- o(this, "_handleStreamAdded", (e) => {
164
+ s(this, "_handleStreamAdded", (e) => {
165
165
  var n;
166
166
  const i = e.stream;
167
167
  console.log("远端流增加: " + i.getId()), (n = this._trtc.client) == null || n.subscribe(i);
168
168
  });
169
- o(this, "_handleStreamSubscribed", (e) => {
169
+ s(this, "_handleStreamSubscribed", (e) => {
170
170
  const i = e.stream;
171
171
  console.log("远端流订阅成功:" + i.getId());
172
172
  const c = `rs-rtc-remote_stream-${i.getId()}`, u = document.createElement("div");
@@ -227,35 +227,35 @@ class rt extends Me {
227
227
  class it extends Me {
228
228
  constructor(e) {
229
229
  super();
230
- o(this, "type", Q.RealseeBrowserChimeRTC);
231
- o(this, "joined", !1);
232
- o(this, "micro", !1);
233
- o(this, "voiceId", "");
234
- o(this, "userId", "");
235
- o(this, "logger");
236
- o(this, "deviceController");
237
- o(this, "meetingSession");
238
- o(this, "audioInput");
239
- o(this, "audioOutput");
240
- o(this, "deviceChangeObserver", {});
241
- o(this, "audioVideoObserver", {});
242
- o(this, "audioMixObserver");
243
- o(this, "_getVoiceSign", () => {
230
+ s(this, "type", Q.RealseeBrowserChimeRTC);
231
+ s(this, "joined", !1);
232
+ s(this, "micro", !1);
233
+ s(this, "voiceId", "");
234
+ s(this, "userId", "");
235
+ s(this, "logger");
236
+ s(this, "deviceController");
237
+ s(this, "meetingSession");
238
+ s(this, "audioInput");
239
+ s(this, "audioOutput");
240
+ s(this, "deviceChangeObserver", {});
241
+ s(this, "audioVideoObserver", {});
242
+ s(this, "audioMixObserver");
243
+ s(this, "_getVoiceSign", () => {
244
244
  throw new Error("方法 getVoiceSign 未实现");
245
245
  });
246
- o(this, "_autoPlayConfirm");
247
- o(this, "$dom", document.createElement("div"));
248
- o(this, "$audio", document.createElement("audio"));
246
+ s(this, "_autoPlayConfirm");
247
+ s(this, "$dom", document.createElement("div"));
248
+ s(this, "$audio", document.createElement("audio"));
249
249
  /**
250
250
  * 对audio标签初始化
251
251
  */
252
- o(this, "_initDom", () => {
252
+ s(this, "_initDom", () => {
253
253
  this.$audio.id = `rs-rtc-${Ee()}`, this.$dom.id = `rs-rtc-${Ee()}`, this.$dom.appendChild(this.$audio), document.body.appendChild(this.$dom);
254
254
  });
255
255
  /**
256
256
  * 初始化事件监听器
257
257
  */
258
- o(this, "initObservers", () => {
258
+ s(this, "initObservers", () => {
259
259
  this.deviceChangeObserver = {
260
260
  audioInputsChanged: (e) => {
261
261
  this.logger.info(`audioInputsChanged ${typeof e}`), e == null || e.forEach((i) => {
@@ -303,7 +303,7 @@ class it extends Me {
303
303
  /**
304
304
  * 注册rtc事件
305
305
  */
306
- o(this, "_registerRtcEvent", () => {
306
+ s(this, "_registerRtcEvent", () => {
307
307
  var i, n, c, u, d, g;
308
308
  const e = ((c = (n = (i = this.meetingSession) == null ? void 0 : i.configuration) == null ? void 0 : n.credentials) == null ? void 0 : c.attendeeId) || "";
309
309
  if (e) {
@@ -447,11 +447,11 @@ var lt = /* @__PURE__ */ ((r) => (r[r.Success = 0] = "Success", r[r.Failure = 1]
447
447
  class nt extends Me {
448
448
  constructor({ jsBridge: e, getVoiceSign: i }) {
449
449
  super();
450
- o(this, "type", Q.RealseeVRWebViewRTC);
451
- o(this, "joined", !1);
452
- o(this, "micro", !1);
453
- o(this, "voiceId", "");
454
- o(this, "options");
450
+ s(this, "type", Q.RealseeVRWebViewRTC);
451
+ s(this, "joined", !1);
452
+ s(this, "micro", !1);
453
+ s(this, "voiceId", "");
454
+ s(this, "options");
455
455
  this.options = { jsBridge: e, getVoiceSign: i }, this.jsBridge.webViewType !== "WxMiniProgramWebView" && this.jsBridge.callAndListen("live/userVolumes", (n) => {
456
456
  this.emit("userVolumes", n);
457
457
  }), this.jsBridge.callAndListen("live/weakNetwork", (n) => {
@@ -471,7 +471,7 @@ class nt extends Me {
471
471
  const [u, d] = await this.jsBridge.callAndBackfeed(
472
472
  `live/join?sdkAppID=${i}&userID=${n}&roomID=${Number(e.voiceId)}&userSig=${c}`
473
473
  );
474
- return u === !0 ? (this.emit("joined"), this.joined = !0) : u ? u.code === lt.Success ? (this.emit("joined"), this.joined = !0) : (this.emit("error", u), this.joined = !1) : (this.emit("error", d || new Error("加入房间失败:未知异常。")), this.joined = !1), this.joined;
474
+ return O.info(`加入语音房间回调结果: ${JSON.stringify(u)}`), d && O.error("加入语音房间回调报错:", d), u === !0 ? (this.emit("joined"), this.joined = !0) : u ? u.code === lt.Success ? (this.emit("joined"), this.joined = !0) : (this.emit("error", u), this.joined = !1) : (this.emit("error", d || new Error("加入房间失败:未知异常。")), this.joined = !1), this.joined;
475
475
  } catch (i) {
476
476
  return this.emit("error", new Error("加入房间失败:" + i.message)), this.joined = !1, this.joined;
477
477
  }
@@ -495,21 +495,21 @@ class nt extends Me {
495
495
  var K = /* @__PURE__ */ ((r) => (r.SelfUserInfo = "SELF_USER_INFO", r.RoomInfo = "ROOM_INFO", r.RTCInfo = "RTC_INFO", r.UserList = "USER_LIST", r.BuiltinMsg = "BUILTIN_MSG", r.CustomEvent = "CUSTOM_EVENT", r.KeyframeSync = "KEYFRAME_SYNC", r.UserKickOut = "USER_KICK_OUT", r))(K || {}), q = /* @__PURE__ */ ((r) => (r.UserChange = "user_change", r.RoomChange = "room_change", r))(q || {}), H = /* @__PURE__ */ ((r) => (r.UserMicroStatus = "change_micro_status", r.UserMicroStatusSync = "sync_micro_status", r.UserPermission = "change_permission", r.UserStatus = "change_status", r.UserInfo = "change_info", r.RoomClose = "close", r))(H || {}), Z = /* @__PURE__ */ ((r) => (r.OPEN = "OPEN", r.CLOSE = "CLOSE", r))(Z || {});
496
496
  function Nr(r) {
497
497
  try {
498
- const s = JSON.parse(r), e = {
499
- code: s.code,
500
- message: s.message,
501
- command: s.command,
502
- roomCode: s.room_code,
503
- appID: s.app_id,
504
- requestId: s.request_id,
505
- frontRequestId: s.front_request_id,
506
- triggerUserID: s.trigger_user_id,
507
- data: s.data || {}
498
+ const o = JSON.parse(r), e = {
499
+ code: o.code,
500
+ message: o.message,
501
+ command: o.command,
502
+ roomCode: o.room_code,
503
+ appID: o.app_id,
504
+ requestId: o.request_id,
505
+ frontRequestId: o.front_request_id,
506
+ triggerUserID: o.trigger_user_id,
507
+ data: o.data || {}
508
508
  }, i = Object.keys(e).filter(
509
509
  (n) => e[n] === void 0
510
510
  );
511
511
  return i.length > 0 && console.warn(`推送数据格式异常:${i.join(" ")} 值不存在!`), e;
512
- } catch (s) {
512
+ } catch (o) {
513
513
  return !1;
514
514
  }
515
515
  }
@@ -541,15 +541,15 @@ function sr(r) {
541
541
  var ft = {};
542
542
  (function(r) {
543
543
  Object.defineProperty(r, "__esModule", { value: !0 }), r.LogLevel = void 0;
544
- var s;
544
+ var o;
545
545
  (function(e) {
546
546
  e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.OFF = 4] = "OFF";
547
- })(s = r.LogLevel || (r.LogLevel = {})), r.default = s;
547
+ })(o = r.LogLevel || (r.LogLevel = {})), r.default = o;
548
548
  })(ft);
549
549
  const st = /* @__PURE__ */ sr(ft);
550
- function or(r, s = {}) {
551
- const e = r.indexOf("?") !== -1, i = Object.keys(s).reduce(
552
- (n, c, u) => `${n}${u === 0 && !e ? "?" : "&"}${c}=${s[c]}`,
550
+ function or(r, o = {}) {
551
+ const e = r.indexOf("?") !== -1, i = Object.keys(o).reduce(
552
+ (n, c, u) => `${n}${u === 0 && !e ? "?" : "&"}${c}=${o[c]}`,
553
553
  ""
554
554
  );
555
555
  return r + i;
@@ -558,141 +558,141 @@ const le = globalThis.navigator.userAgent, ar = /android/gi.test(le), cr = /iPho
558
558
  function ye(r) {
559
559
  return Object.prototype.toString.call(r) === "[object Object]";
560
560
  }
561
- function Se(r, s) {
562
- return r === s ? !0 : typeof r != typeof s ? !1 : !!(Number.isNaN(r) && Number.isNaN(s));
561
+ function Se(r, o) {
562
+ return r === o ? !0 : typeof r != typeof o ? !1 : !!(Number.isNaN(r) && Number.isNaN(o));
563
563
  }
564
- function fr(r, s) {
565
- const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(s);
564
+ function fr(r, o) {
565
+ const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(o);
566
566
  if (e.length !== i.length)
567
567
  return !1;
568
568
  for (let n = 0, c = e.length; n < c; n++) {
569
569
  const u = e[n];
570
- if (!Se(r[u], s[u]))
570
+ if (!Se(r[u], o[u]))
571
571
  return !1;
572
572
  }
573
573
  return !0;
574
574
  }
575
- function dr(r, s) {
576
- if (r.length !== s.length)
575
+ function dr(r, o) {
576
+ if (r.length !== o.length)
577
577
  return !1;
578
578
  for (let e = 0, i = r.length; e < i; e++)
579
- if (!Se(r[e], s[e]))
579
+ if (!Se(r[e], o[e]))
580
580
  return !1;
581
581
  return !0;
582
582
  }
583
- function hr(r, s) {
584
- return Se(r, s) ? !0 : ye(r) && ye(s) ? fr(r, s) : Array.isArray(r) && Array.isArray(s) ? dr(r, s) : !1;
583
+ function hr(r, o) {
584
+ return Se(r, o) ? !0 : ye(r) && ye(o) ? fr(r, o) : Array.isArray(r) && Array.isArray(o) ? dr(r, o) : !1;
585
585
  }
586
- function De(r, s) {
587
- return Se(r, s) ? !0 : ye(r) && ye(s) ? gr(r, s) : Array.isArray(r) && Array.isArray(s) ? _r(r, s) : !1;
586
+ function De(r, o) {
587
+ return Se(r, o) ? !0 : ye(r) && ye(o) ? gr(r, o) : Array.isArray(r) && Array.isArray(o) ? _r(r, o) : !1;
588
588
  }
589
- function _r(r, s) {
590
- if (r.length !== s.length)
589
+ function _r(r, o) {
590
+ if (r.length !== o.length)
591
591
  return !1;
592
592
  for (let e = 0, i = r.length; e < i; e++)
593
- if (!De(r[e], s[e]))
593
+ if (!De(r[e], o[e]))
594
594
  return !1;
595
595
  return !0;
596
596
  }
597
- function gr(r, s) {
598
- const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(s);
597
+ function gr(r, o) {
598
+ const e = Object.getOwnPropertyNames(r), i = Object.getOwnPropertyNames(o);
599
599
  if (e.length !== i.length)
600
600
  return !1;
601
601
  for (let n = 0, c = e.length; n < c; n++) {
602
602
  const u = e[n];
603
- if (!De(r[u], s[u]))
603
+ if (!De(r[u], o[u]))
604
604
  return !1;
605
605
  }
606
606
  return !0;
607
607
  }
608
- function ot(r, s, e = { deep: !1 }) {
609
- return e.deep ? De(r, s) : hr(r, s);
608
+ function ot(r, o, e = { deep: !1 }) {
609
+ return e.deep ? De(r, o) : hr(r, o);
610
610
  }
611
611
  class mr extends ue {
612
612
  constructor(e) {
613
613
  super();
614
- o(this, "_realWebSocket");
615
- o(this, "_url");
616
- o(this, "_protocols");
617
- o(this, "_readyState", Le.NOTINITIALIZED);
618
- o(this, "_options", {
614
+ s(this, "_realWebSocket");
615
+ s(this, "_url");
616
+ s(this, "_protocols");
617
+ s(this, "_readyState", Le.NOTINITIALIZED);
618
+ s(this, "_options", {
619
619
  timeout: 1e4,
620
620
  shouldReconnect: (e, i) => {
621
621
  if (!(e.code === 1008 || e.code === 1011))
622
- return [1e3, 3e3, 6e3][i.attempts % 3];
622
+ return [0, 1e3, 2e3][i.attempts % 3];
623
623
  },
624
624
  should1000Reconnect: !1,
625
625
  ignoreConnectivityEvents: !1,
626
626
  automaticOpen: !1
627
627
  });
628
- o(this, "_connectTimeout");
629
- o(this, "_attempts", 0);
630
- o(this, "_reconnects", -1);
631
- o(this, "_reconnectWhenOnlineAgain", !1);
632
- o(this, "_explicitlyClosed", !1);
633
- o(this, "_pendingReconnect");
634
- o(this, "_connectivityEventsAttached", !1);
635
- o(this, "_heathCheckTimer");
628
+ s(this, "_connectTimeout");
629
+ s(this, "_attempts", 0);
630
+ s(this, "_reconnects", -1);
631
+ s(this, "_reconnectWhenOnlineAgain", !1);
632
+ s(this, "_explicitlyClosed", !1);
633
+ s(this, "_pendingReconnect");
634
+ s(this, "_connectivityEventsAttached", !1);
635
+ s(this, "_heathCheckTimer");
636
636
  /**
637
637
  * 做一个健康检查
638
638
  */
639
- o(this, "_healthCheck", async () => {
639
+ s(this, "_healthCheck", async () => {
640
640
  this._realWebSocket && this._realWebSocket.readyState !== this._readyState && (this._readyState = this._realWebSocket.readyState, this._readyState === Le.CLOSING && this.emit("closing")), await new Promise((e) => setTimeout(e, 2e3)), this._heathCheckTimer = requestAnimationFrame(this._healthCheck);
641
641
  });
642
642
  /**
643
643
  * 清理超时计时器
644
644
  */
645
- o(this, "_clearConnectTimeoutIfNeed", () => {
645
+ s(this, "_clearConnectTimeoutIfNeed", () => {
646
646
  this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
647
647
  });
648
648
  /**
649
649
  * 清理健康检查
650
650
  */
651
- o(this, "_clearHeathCheckIfNeed", () => {
651
+ s(this, "_clearHeathCheckIfNeed", () => {
652
652
  this._heathCheckTimer && (cancelAnimationFrame(this._heathCheckTimer), this._heathCheckTimer = void 0);
653
653
  });
654
654
  /**
655
655
  * 开启健康检查
656
656
  */
657
- o(this, "_startHealthCheck", () => {
657
+ s(this, "_startHealthCheck", () => {
658
658
  this._clearHeathCheckIfNeed(), this._heathCheckTimer = requestAnimationFrame(this._healthCheck);
659
659
  });
660
660
  /**
661
661
  * 停止健康检查
662
662
  */
663
- o(this, "_stopHealthCheck", () => {
663
+ s(this, "_stopHealthCheck", () => {
664
664
  this._clearHeathCheckIfNeed();
665
665
  });
666
666
  /**
667
667
  * 清理连接中的请求
668
668
  */
669
- o(this, "_clearPendingReconnectIfNeeded", () => {
669
+ s(this, "_clearPendingReconnectIfNeeded", () => {
670
670
  this._pendingReconnect && (clearTimeout(this._pendingReconnect), this._pendingReconnect = void 0);
671
671
  });
672
672
  /**
673
673
  * 当网页连接上网络进行重连
674
674
  * @param event
675
675
  */
676
- o(this, "_online", (e) => {
676
+ s(this, "_online", (e) => {
677
677
  this._reconnectWhenOnlineAgain && (this._clearPendingReconnectIfNeeded(), this._reconnect(e));
678
678
  });
679
679
  /**
680
680
  * 当网页断开网络进行关闭
681
681
  */
682
- o(this, "_offline", () => {
682
+ s(this, "_offline", () => {
683
683
  var e;
684
684
  this._reconnectWhenOnlineAgain = !0, (e = this._realWebSocket) == null || e.close(1e3, "offline");
685
685
  });
686
686
  /**
687
687
  * 解除网络监听事件
688
688
  */
689
- o(this, "_detachConnectivityEvents", () => {
689
+ s(this, "_detachConnectivityEvents", () => {
690
690
  this._connectivityEventsAttached && (globalThis == null || globalThis.removeEventListener("online", this._online), globalThis == null || globalThis.removeEventListener("offline", this._offline), this._connectivityEventsAttached = !1);
691
691
  });
692
692
  /**
693
693
  * 注册网络监听事件
694
694
  */
695
- o(this, "_attachConnectivityEvents", () => {
695
+ s(this, "_attachConnectivityEvents", () => {
696
696
  this._connectivityEventsAttached || (globalThis == null || globalThis.addEventListener("online", this._online), globalThis == null || globalThis.addEventListener("offline", this._offline), this._connectivityEventsAttached = !0);
697
697
  });
698
698
  /**
@@ -700,7 +700,7 @@ class mr extends ue {
700
700
  * @param data
701
701
  * @returns
702
702
  */
703
- o(this, "send", (e) => {
703
+ s(this, "send", (e) => {
704
704
  var i, n, c;
705
705
  ((i = this._realWebSocket) == null ? void 0 : i.readyState) === ((n = this._realWebSocket) == null ? void 0 : n.OPEN) && ((c = this._realWebSocket) == null || c.send(e));
706
706
  });
@@ -710,21 +710,21 @@ class mr extends ue {
710
710
  * @param reason 原因
711
711
  * @returns
712
712
  */
713
- o(this, "close", (e, i) => {
713
+ s(this, "close", (e, i) => {
714
714
  var n;
715
715
  return typeof e != "number" && (i = e, e = 1e3), this._clearPendingReconnectIfNeeded(), this._reconnectWhenOnlineAgain = !1, this._explicitlyClosed = !0, this._detachConnectivityEvents(), (n = this._realWebSocket) == null ? void 0 : n.close(e, i);
716
716
  });
717
717
  /**
718
718
  * 进行ws连接
719
719
  */
720
- o(this, "open", (e) => {
720
+ s(this, "open", (e) => {
721
721
  var i, n;
722
722
  e && (this._url = e), ((i = this._realWebSocket) == null ? void 0 : i.readyState) !== WebSocket.OPEN && ((n = this._realWebSocket) == null ? void 0 : n.readyState) !== WebSocket.CONNECTING && (this._clearPendingReconnectIfNeeded(), this._reconnectWhenOnlineAgain = !1, this._explicitlyClosed = !1, this._createWebSocket());
723
723
  });
724
724
  /**
725
725
  * 创建ws连接
726
726
  */
727
- o(this, "_createWebSocket", () => {
727
+ s(this, "_createWebSocket", () => {
728
728
  var n, c, u;
729
729
  const e = typeof this._url == "string" ? this._url : (n = this._url) == null ? void 0 : n.call(this, this);
730
730
  if (!e)
@@ -751,14 +751,14 @@ class mr extends ue {
751
751
  /**
752
752
  * 断开ws事件
753
753
  */
754
- o(this, "_removeWebSocketEvent", () => {
754
+ s(this, "_removeWebSocketEvent", () => {
755
755
  var e, i, n, c;
756
756
  (e = this._realWebSocket) == null || e.removeEventListener("open", this._webSocketOpenHandler), (i = this._realWebSocket) == null || i.removeEventListener("close", this._webSocketCloseHandler), (n = this._realWebSocket) == null || n.removeEventListener("error", this._webSocketErrorHandler), (c = this._realWebSocket) == null || c.removeEventListener("message", this._webSocketMessageHandler);
757
757
  });
758
758
  /**
759
759
  * 分发ws事件
760
760
  */
761
- o(this, "_dispatchWebSocketEvent", () => {
761
+ s(this, "_dispatchWebSocketEvent", () => {
762
762
  var e, i, n, c;
763
763
  (e = this._realWebSocket) == null || e.addEventListener("open", this._webSocketOpenHandler), (i = this._realWebSocket) == null || i.addEventListener("close", this._webSocketCloseHandler), (n = this._realWebSocket) == null || n.addEventListener("error", this._webSocketErrorHandler), (c = this._realWebSocket) == null || c.addEventListener("message", this._webSocketMessageHandler);
764
764
  });
@@ -766,7 +766,7 @@ class mr extends ue {
766
766
  * ws连接事件
767
767
  * @returns
768
768
  */
769
- o(this, "_webSocketOpenHandler", (e) => {
769
+ s(this, "_webSocketOpenHandler", (e) => {
770
770
  this._connectTimeout && (clearTimeout(this._connectTimeout), this._connectTimeout = void 0);
771
771
  const i = ++this._reconnects, n = this._attempts;
772
772
  return this._attempts = 0, this._reconnectWhenOnlineAgain = !1, this._startHealthCheck(), this.emit("open", Object.assign(e, { detail: { reconnects: i, attempts: n } }));
@@ -776,19 +776,19 @@ class mr extends ue {
776
776
  * @param event
777
777
  * @returns
778
778
  */
779
- o(this, "_webSocketCloseHandler", (e) => (this._reconnect(e), this._stopHealthCheck(), this.emit("close", e)));
779
+ s(this, "_webSocketCloseHandler", (e) => (this._reconnect(e), this._stopHealthCheck(), this.emit("close", e)));
780
780
  /**
781
781
  * ws 异常
782
782
  * @param event
783
783
  * @returns
784
784
  */
785
- o(this, "_webSocketErrorHandler", (e) => this.emit("error", new CustomEvent("error", { detail: { error: e } })));
785
+ s(this, "_webSocketErrorHandler", (e) => this.emit("error", new CustomEvent("error", { detail: { error: e } })));
786
786
  /**
787
787
  * ws消息
788
788
  * @param event
789
789
  * @returns
790
790
  */
791
- o(this, "_webSocketMessageHandler", (e) => this.emit("message", e));
791
+ s(this, "_webSocketMessageHandler", (e) => this.emit("message", e));
792
792
  e && this.setOptions(e), this._startHealthCheck();
793
793
  }
794
794
  get attempts() {
@@ -832,31 +832,31 @@ class vr extends ue {
832
832
  /**
833
833
  * ws代理器
834
834
  */
835
- o(this, "_ws", new mr({
835
+ s(this, "_ws", new mr({
836
836
  url: "",
837
837
  robustOptions: { should1000Reconnect: !0, ignoreConnectivityEvents: !0 }
838
838
  }));
839
839
  /**
840
840
  * 带看连接状态
841
841
  */
842
- o(this, "_state", x.NOTINITIALIZED);
842
+ s(this, "_state", x.NOTINITIALIZED);
843
843
  /**
844
844
  * 添加事件监听
845
845
  */
846
- o(this, "_addWebSocketEventListeners", () => {
846
+ s(this, "_addWebSocketEventListeners", () => {
847
847
  this._ws.on("close", this._handleCloseEvent), this._ws.on("closing", this._handleClosingEvent), this._ws.on("connecting", this._handleConnectingEvent), this._ws.on("error", this._handleErrorEvent), this._ws.on("message", this._handleMessageEvent), this._ws.on("open", this._handleOpenEvent), this._ws.on("timeout", this._handleTimeoutEvent);
848
848
  });
849
849
  /**
850
850
  * 移除事件监听
851
851
  */
852
- o(this, "_removeWebSocketEventListeners", () => {
852
+ s(this, "_removeWebSocketEventListeners", () => {
853
853
  this._ws.off("close", this._handleCloseEvent), this._ws.off("closing", this._handleClosingEvent), this._ws.off("connecting", this._handleConnectingEvent), this._ws.off("error", this._handleErrorEvent), this._ws.off("message", this._handleMessageEvent), this._ws.off("open", this._handleOpenEvent), this._ws.off("timeout", this._handleTimeoutEvent);
854
854
  });
855
855
  /**
856
856
  * 处理房间关闭事件
857
857
  * @param event
858
858
  */
859
- o(this, "_handleCloseEvent", (e) => {
859
+ s(this, "_handleCloseEvent", (e) => {
860
860
  O.info(
861
861
  `live room closed bacause of ${e.code}-${e.reason || nr(e.code)}`
862
862
  ), this.state = x.CLOSED;
@@ -864,7 +864,7 @@ class vr extends ue {
864
864
  /**
865
865
  * 处理房间正在关闭事件(这个时候可能是断网了)
866
866
  */
867
- o(this, "_handleClosingEvent", () => {
867
+ s(this, "_handleClosingEvent", () => {
868
868
  var e;
869
869
  O.info("live room is closing, onLine:", (e = globalThis == null ? void 0 : globalThis.navigator) == null ? void 0 : e.onLine), this.state = x.CLOSED;
870
870
  });
@@ -872,21 +872,21 @@ class vr extends ue {
872
872
  * 连接中
873
873
  * @param event
874
874
  */
875
- o(this, "_handleConnectingEvent", () => {
875
+ s(this, "_handleConnectingEvent", () => {
876
876
  O.info("live room is connecting"), this.state = x.CONNECTING;
877
877
  });
878
878
  /**
879
879
  * 连接发送异常
880
880
  * @param event
881
881
  */
882
- o(this, "_handleErrorEvent", (e) => {
882
+ s(this, "_handleErrorEvent", (e) => {
883
883
  O.error("live room error", e), this.state = x.CLOSED;
884
884
  });
885
885
  /**
886
886
  * 接收到消息
887
887
  * @param event
888
888
  */
889
- o(this, "_handleMessageEvent", (e) => {
889
+ s(this, "_handleMessageEvent", (e) => {
890
890
  let i = (() => {
891
891
  try {
892
892
  return JSON.parse(e.data);
@@ -900,33 +900,33 @@ class vr extends ue {
900
900
  * 连接建立成功
901
901
  * @param event
902
902
  */
903
- o(this, "_handleOpenEvent", (e) => {
903
+ s(this, "_handleOpenEvent", (e) => {
904
904
  O.info("live room open", e.detail), this.state = x.OPEN, e.detail.reconnects > 0 && this.emit("reconnected", e.detail);
905
905
  });
906
906
  /**
907
907
  * 处理超时
908
908
  * @param event
909
909
  */
910
- o(this, "_handleTimeoutEvent", (e) => {
910
+ s(this, "_handleTimeoutEvent", (e) => {
911
911
  O.error("live room connect timeout!", e.detail), this.state = x.CLOSED;
912
912
  });
913
913
  /**
914
914
  * 释放资源,释放之后需要重新实例化
915
915
  * @returns
916
916
  */
917
- o(this, "dispose", async () => (this._removeWebSocketEventListeners(), await this.close("live room close by controller disposed!")));
917
+ s(this, "dispose", async () => (this._removeWebSocketEventListeners(), await this.close("live room close by controller disposed!")));
918
918
  /**
919
919
  * 开启房间链接
920
920
  * @param url 房间链接
921
921
  * @returns
922
922
  */
923
- o(this, "open", (e) => this._ws.open(e));
923
+ s(this, "open", (e) => this._ws.open(e));
924
924
  /**
925
925
  * 关闭房间
926
926
  * @param code
927
927
  * @param reason
928
928
  */
929
- o(this, "close", (e, i) => new Promise((n) => {
929
+ s(this, "close", (e, i) => new Promise((n) => {
930
930
  this._ws.once("close", () => n(!0)), this._ws.close(e, i);
931
931
  }));
932
932
  this._addWebSocketEventListeners();
@@ -949,17 +949,23 @@ class vr extends ue {
949
949
  return this._ws.send(JSON.stringify(e));
950
950
  throw new Error("live has not yet been initialized!");
951
951
  }
952
+ /**
953
+ * 准备关闭带看
954
+ */
955
+ readyClose() {
956
+ this._ws && (this._ws._explicitlyClosed = !0);
957
+ }
952
958
  }
953
- const pr = (r) => Promise.reject("unimplemented method GetVoiceSign"), je = (r, s = {}, e = []) => ({
959
+ const pr = (r) => Promise.reject("unimplemented method GetVoiceSign"), je = (r, o = {}, e = []) => ({
954
960
  command: r,
955
961
  front_request_id: Ee(),
956
962
  data: {
957
- ...s,
963
+ ...o,
958
964
  to_user_ids: Array.isArray(e) ? e : [e]
959
965
  }
960
966
  }), Er = () => {
961
- var r, s;
962
- window != null && window.__Realsee_Live__ && ((s = (r = window == null ? void 0 : window.__Realsee_Live__) == null ? void 0 : r.dispose) == null || s.call(r), window.__Realsee_Live__ = null);
967
+ var r, o;
968
+ window != null && window.__Realsee_Live__ && ((o = (r = window == null ? void 0 : window.__Realsee_Live__) == null ? void 0 : r.dispose) == null || o.call(r), window.__Realsee_Live__ = null);
963
969
  };
964
970
  class yr extends ue {
965
971
  constructor(e) {
@@ -968,15 +974,15 @@ class yr extends ue {
968
974
  /**
969
975
  * 带看的配置
970
976
  */
971
- o(this, "_options", {});
977
+ s(this, "_options", {});
972
978
  /**
973
979
  * 帧数据监听
974
980
  */
975
- o(this, "keyframes", new ue());
981
+ s(this, "keyframes", new ue());
976
982
  /**
977
983
  * 内置的一些数据
978
984
  */
979
- o(this, "_buildInData", {
985
+ s(this, "_buildInData", {
980
986
  keyframes: {}
981
987
  });
982
988
  /**
@@ -984,14 +990,14 @@ class yr extends ue {
984
990
  * @param key 帧数据的键值
985
991
  * @returns
986
992
  */
987
- o(this, "getFramesByKey", (e) => this.snapshot[e]);
993
+ s(this, "getFramesByKey", (e) => this.snapshot[e]);
988
994
  /**
989
995
  * 发送帧数据(需要能够被序列化)
990
996
  * @param key 帧数据键值
991
997
  * @param frame 帧数据本体
992
998
  * @returns
993
999
  */
994
- o(this, "sendKeyframe", (e, i) => {
1000
+ s(this, "sendKeyframe", (e, i) => {
995
1001
  if (this.state !== x.OPEN)
996
1002
  return !1;
997
1003
  this._buildInData.keyframes = {
@@ -1008,17 +1014,17 @@ class yr extends ue {
1008
1014
  /**
1009
1015
  * 带看控制器
1010
1016
  */
1011
- o(this, "_controller", new vr());
1017
+ s(this, "_controller", new vr());
1012
1018
  /**
1013
1019
  * 添加带看控制的事件监听
1014
1020
  */
1015
- o(this, "_addLiveControllerEventListeners", () => {
1021
+ s(this, "_addLiveControllerEventListeners", () => {
1016
1022
  this._controller.on("stateChange", this._handleStateChange), this._controller.on("message", this._handleMessage);
1017
1023
  });
1018
1024
  /**
1019
1025
  * 移除带看控制的事件监听
1020
1026
  */
1021
- o(this, "_removeLiveControllerEventListeners", () => {
1027
+ s(this, "_removeLiveControllerEventListeners", () => {
1022
1028
  this._controller.off("stateChange", this._handleStateChange), this._controller.off("message", this._handleMessage);
1023
1029
  });
1024
1030
  /**
@@ -1026,12 +1032,12 @@ class yr extends ue {
1026
1032
  * @param state
1027
1033
  * @returns
1028
1034
  */
1029
- o(this, "_handleStateChange", (e, i) => this.emit("stateChange", e, i));
1035
+ s(this, "_handleStateChange", (e, i) => this.emit("stateChange", e, i));
1030
1036
  /**
1031
1037
  * 消息接收
1032
1038
  * @param liveMsg
1033
1039
  */
1034
- o(this, "_handleMessage", async (e) => {
1040
+ s(this, "_handleMessage", async (e) => {
1035
1041
  var i, n, c, u, d;
1036
1042
  if (typeof e == "object") {
1037
1043
  const { command: g, data: v = {}, frontRequestId: E, code: y, message: I } = e;
@@ -1039,19 +1045,12 @@ class yr extends ue {
1039
1045
  switch (g) {
1040
1046
  case K.SelfUserInfo: {
1041
1047
  const _ = v;
1042
- ot(this.selfInfo, _, { deep: !0 }) || (this._buildInData.selfInfo = _, this.emit(
1043
- "selfInfoUpdate",
1044
- this._buildInData.selfInfo,
1045
- E
1046
- ));
1048
+ ot(this.selfInfo, _, { deep: !0 }) || (this._buildInData.selfInfo = _, this.emit("selfInfoUpdate", this._buildInData.selfInfo, E));
1047
1049
  break;
1048
1050
  }
1049
1051
  case K.RoomInfo: {
1050
1052
  const _ = v;
1051
- this._buildInData.roomInfo = Object.assign({}, _), this.emit(
1052
- "readyKeyframeSync",
1053
- _.last_frame || {}
1054
- );
1053
+ this._buildInData.roomInfo = Object.assign({}, _), this.emit("readyKeyframeSync", _.last_frame || {});
1055
1054
  break;
1056
1055
  }
1057
1056
  case K.RTCInfo: {
@@ -1081,23 +1080,13 @@ class yr extends ue {
1081
1080
  break;
1082
1081
  }
1083
1082
  case K.KeyframeSync: {
1084
- const _ = v, V = Object.keys(
1085
- _
1086
- ).reduce(
1083
+ const _ = v, V = Object.keys(_).reduce(
1087
1084
  (C, k) => {
1088
- if (ot(
1089
- _[k],
1090
- this._buildInData.keyframes[k],
1091
- {
1092
- deep: !0
1093
- }
1094
- ))
1085
+ if (ot(_[k], this._buildInData.keyframes[k], {
1086
+ deep: !0
1087
+ }))
1095
1088
  return C;
1096
- const U = [
1097
- _[k],
1098
- this._buildInData.keyframes[k],
1099
- E
1100
- ], P = k;
1089
+ const U = [_[k], this._buildInData.keyframes[k], E], P = k;
1101
1090
  return this.keyframes.emit(
1102
1091
  P,
1103
1092
  ...U
@@ -1110,9 +1099,7 @@ class yr extends ue {
1110
1099
  }
1111
1100
  case K.BuiltinMsg: {
1112
1101
  const _ = v;
1113
- this.emit("builtinEvent", _), _.event_type === q.UserChange && this.emit("userChange", _), _.event_type === q.RoomChange && this.emit("roomChange", _), _.event_type === q.UserChange && _.action === H.UserMicroStatus && await this.toggleMicro(
1114
- _.data.status === Z.OPEN
1115
- ), _.event_type === q.RoomChange && _.action === H.RoomClose && await this.exit();
1102
+ this.emit("builtinEvent", _), _.event_type === q.UserChange && this.emit("userChange", _), _.event_type === q.RoomChange && this.emit("roomChange", _), _.event_type === q.UserChange && _.action === H.UserMicroStatus && await this.toggleMicro(_.data.status === Z.OPEN), _.event_type === q.RoomChange && _.action === H.RoomClose && await this._exit();
1116
1103
  break;
1117
1104
  }
1118
1105
  case K.UserKickOut: {
@@ -1129,7 +1116,7 @@ class yr extends ue {
1129
1116
  /**
1130
1117
  * 清理带看缓存的数据
1131
1118
  */
1132
- o(this, "_clearLiveData", () => {
1119
+ s(this, "_clearLiveData", () => {
1133
1120
  this._buildInData = { keyframes: {} };
1134
1121
  });
1135
1122
  /**
@@ -1137,7 +1124,7 @@ class yr extends ue {
1137
1124
  * @param options
1138
1125
  * @returns
1139
1126
  */
1140
- o(this, "connect", async (e = {}) => {
1127
+ s(this, "connect", async (e = {}) => {
1141
1128
  var u, d, g, v;
1142
1129
  if (this._options.url = (d = (u = e.url) != null ? u : this._options.url) != null ? d : "", this._options.getTicket = (g = e.getTicket) != null ? g : this._options.getTicket, this._options.initialMicroStatus = (v = e.rtcMicStatus) != null ? v : this._options.initialMicroStatus, !/^ws(s):\/\//.test(this._options.url) || typeof this._options.getTicket != "function")
1143
1130
  return /^ws(s):\/\//.test(this._options.url) ? typeof this._options.getTicket != "function" ? new Error("getTicket muse be function") : !1 : new Error("Illegal realsee live room link");
@@ -1165,45 +1152,50 @@ class yr extends ue {
1165
1152
  * 退出带看
1166
1153
  * @returns
1167
1154
  */
1168
- o(this, "exit", async () => {
1155
+ s(this, "_exit", async () => {
1169
1156
  var e;
1170
- if (this._clearLiveData(), this.state !== x.OPEN)
1171
- return !0;
1157
+ this._clearLiveData();
1172
1158
  try {
1173
1159
  await ((e = this.$RTC) == null ? void 0 : e.quit());
1174
1160
  } catch (i) {
1175
1161
  O.warn(i);
1176
1162
  }
1177
- return await this._controller.close();
1163
+ return this.state !== x.OPEN ? !0 : await this._controller.close();
1178
1164
  });
1165
+ /**
1166
+ * 退出带看
1167
+ * @returns
1168
+ */
1169
+ s(this, "exit", async () => this.close());
1179
1170
  /**
1180
1171
  * 关闭带看房间
1181
1172
  * @param code
1182
1173
  * @param reason
1183
1174
  * @returns
1184
1175
  */
1185
- o(this, "close", async () => await this.updateStatus(
1186
- q.RoomChange,
1187
- H.RoomClose,
1188
- {}
1189
- ));
1176
+ s(this, "close", async () => {
1177
+ var e;
1178
+ await this._controller.readyClose();
1179
+ try {
1180
+ await ((e = this.$RTC) == null ? void 0 : e.quit());
1181
+ } catch (i) {
1182
+ O.warn(i);
1183
+ }
1184
+ await this.updateStatus(q.RoomChange, H.RoomClose, {});
1185
+ });
1190
1186
  /**
1191
1187
  * 销毁带看
1192
1188
  * @returns
1193
1189
  */
1194
- o(this, "dispose", async () => (this._removeLiveControllerEventListeners(), this._clearLiveData(), await this._controller.dispose()));
1190
+ s(this, "dispose", async () => (this._removeLiveControllerEventListeners(), this._clearLiveData(), await this._controller.dispose()));
1195
1191
  /**
1196
1192
  * 设置自己的用户信息
1197
1193
  * @param userInfo
1198
1194
  * @returns
1199
1195
  */
1200
- o(this, "setSelfInfo", async (e) => await this.updateStatus(
1201
- q.UserChange,
1202
- H.UserInfo,
1203
- e
1204
- ));
1196
+ s(this, "setSelfInfo", async (e) => await this.updateStatus(q.UserChange, H.UserInfo, e));
1205
1197
  // 仅用于用户自己的麦克风控制
1206
- o(this, "toggleMicro", async (e) => {
1198
+ s(this, "toggleMicro", async (e) => {
1207
1199
  var n, c, u;
1208
1200
  if (!((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_own_micro))
1209
1201
  return !1;
@@ -1223,7 +1215,7 @@ class yr extends ue {
1223
1215
  * @param toUserIds
1224
1216
  * @returns
1225
1217
  */
1226
- o(this, "forbidMicro", async (e, i) => {
1218
+ s(this, "forbidMicro", async (e, i) => {
1227
1219
  var n, c;
1228
1220
  return typeof this._options.canForbidUserMicro == "function" && !this._options.canForbidUserMicro(i) || !((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_other_micro) ? !1 : await this.updateStatus(
1229
1221
  q.UserChange,
@@ -1240,7 +1232,7 @@ class yr extends ue {
1240
1232
  * @param toUserIds
1241
1233
  * @returns
1242
1234
  */
1243
- o(this, "forbidSync", async (e, i) => {
1235
+ s(this, "forbidSync", async (e, i) => {
1244
1236
  var n, c;
1245
1237
  return typeof this._options.canForbidUserSync == "function" && !this._options.canForbidUserSync(i) || !((c = (n = this.selfInfo) == null ? void 0 : n.permission) != null && c.control_other_sync) ? !1 : await this.updateStatus(
1246
1238
  q.UserChange,
@@ -1254,7 +1246,7 @@ class yr extends ue {
1254
1246
  * @param toUserIds
1255
1247
  * @returns
1256
1248
  */
1257
- o(this, "kick", async (e) => {
1249
+ s(this, "kick", async (e) => {
1258
1250
  var i, n;
1259
1251
  return typeof this._options.canForbidUserKick == "function" && !this._options.canForbidUserKick(e) || !((n = (i = this.selfInfo) == null ? void 0 : i.permission) != null && n.change_other_status) ? !1 : await this.updateStatus(
1260
1252
  q.UserChange,
@@ -1265,10 +1257,7 @@ class yr extends ue {
1265
1257
  e
1266
1258
  );
1267
1259
  });
1268
- this._addLiveControllerEventListeners(), this._options = Object.assign(
1269
- { initialMicroStatus: Z.OPEN },
1270
- e
1271
- ), this._options.jsBridge = (() => {
1260
+ this._addLiveControllerEventListeners(), this._options = Object.assign({ initialMicroStatus: Z.OPEN }, e), this._options.jsBridge = (() => {
1272
1261
  if (e.jsBridge)
1273
1262
  return e.jsBridge;
1274
1263
  if (e.useBuiltInJsBridge)
@@ -1277,18 +1266,14 @@ class yr extends ue {
1277
1266
  if (e.rtc)
1278
1267
  return e.rtc;
1279
1268
  if (e.rtcType)
1280
- switch (e.getVoiceSign || O.error(
1281
- "GetVoiceSign method must be passed when using built-in RTC instances"
1282
- ), e.rtcType) {
1269
+ switch (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), e.rtcType) {
1283
1270
  case Q.RealseeVRWebViewRTC: {
1284
1271
  if (this._options.jsBridge)
1285
1272
  return new nt({
1286
1273
  jsBridge: this._options.jsBridge,
1287
1274
  getVoiceSign: this._options.getVoiceSign
1288
1275
  });
1289
- O.error(
1290
- "JsBridge instance must be passed when using built-in VRWebViewRTC instances"
1291
- );
1276
+ O.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");
1292
1277
  return;
1293
1278
  }
1294
1279
  case Q.RealseeBrowserChimeRTC:
@@ -1297,9 +1282,7 @@ class yr extends ue {
1297
1282
  logLevel: e.__debug__ ? st.DEBUG : st.INFO
1298
1283
  });
1299
1284
  case Q.RealseeBrowserRTC:
1300
- return this._options.autoPlayConfirm || O.error(
1301
- "autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"
1302
- ), new rt({
1285
+ return this._options.autoPlayConfirm || O.error("autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"), new rt({
1303
1286
  getVoiceSign: this._options.getVoiceSign,
1304
1287
  autoPlayConfirm: this._options.autoPlayConfirm
1305
1288
  });
@@ -1309,9 +1292,7 @@ class yr extends ue {
1309
1292
  }
1310
1293
  }
1311
1294
  if (e.useBuiltInRTC) {
1312
- if (e.getVoiceSign || O.error(
1313
- "GetVoiceSign method must be passed when using built-in RTC instances"
1314
- ), this._options.jsBridge)
1295
+ if (e.getVoiceSign || O.error("GetVoiceSign method must be passed when using built-in RTC instances"), this._options.jsBridge)
1315
1296
  return lr && (ar || cr) || ur ? new nt({
1316
1297
  jsBridge: this._options.jsBridge,
1317
1298
  getVoiceSign: this._options.getVoiceSign
@@ -1321,9 +1302,7 @@ class yr extends ue {
1321
1302
  getVoiceSign: this._options.getVoiceSign,
1322
1303
  autoPlayConfirm: this._options.autoPlayConfirm
1323
1304
  });
1324
- O.error(
1325
- "jsBridge instance must be passed when using built-in RTC instances"
1326
- );
1305
+ O.error("jsBridge instance must be passed when using built-in RTC instances");
1327
1306
  return;
1328
1307
  }
1329
1308
  })(), this._options.rtc || O.warn("unused rtc"), this._options.url && this._options.getTicket && this.connect(), this._options.__debug__ && Object.assign(window, { $liveController: this._controller, $live: this });
@@ -1398,10 +1377,7 @@ class yr extends ue {
1398
1377
  async updateStatus(e, i, n, c) {
1399
1378
  if (this.state !== x.OPEN)
1400
1379
  return !1;
1401
- const u = Object.assign(
1402
- { event_type: e, action: i },
1403
- { data: n }
1404
- ), d = je(K.BuiltinMsg, u, c);
1380
+ const u = Object.assign({ event_type: e, action: i }, { data: n }), d = je(K.BuiltinMsg, u, c);
1405
1381
  try {
1406
1382
  return this._controller.sendMessage(d), !0;
1407
1383
  } catch (g) {
@@ -1417,11 +1393,7 @@ class yr extends ue {
1417
1393
  */
1418
1394
  broadcast(e, i, n) {
1419
1395
  return this.state !== x.OPEN ? !1 : new Promise((c, u) => {
1420
- const d = je(
1421
- K.CustomEvent,
1422
- e,
1423
- i
1424
- ), g = d.front_request_id, v = n ? setTimeout(() => {
1396
+ const d = je(K.CustomEvent, e, i), g = d.front_request_id, v = n ? setTimeout(() => {
1425
1397
  u(new Error("RESPONSE TIMEOUT")), this.off("broadcast", E);
1426
1398
  }, n) : void 0, E = (y, I) => {
1427
1399
  I === g && (v && clearTimeout(v), this.off("broadcast", E), c(y));
@@ -1458,7 +1430,7 @@ function Cr() {
1458
1430
  if (at)
1459
1431
  return oe;
1460
1432
  at = 1;
1461
- var r = D, s = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
1433
+ var r = D, o = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
1462
1434
  function u(d, g, v) {
1463
1435
  var E, y = {}, I = null, _ = null;
1464
1436
  v !== void 0 && (I = "" + v), g.key !== void 0 && (I = "" + g.key), g.ref !== void 0 && (_ = g.ref);
@@ -1467,7 +1439,7 @@ function Cr() {
1467
1439
  if (d && d.defaultProps)
1468
1440
  for (E in g = d.defaultProps, g)
1469
1441
  y[E] === void 0 && (y[E] = g[E]);
1470
- return { $$typeof: s, type: d, key: I, ref: _, props: y, _owner: n.current };
1442
+ return { $$typeof: o, type: d, key: I, ref: _, props: y, _owner: n.current };
1471
1443
  }
1472
1444
  return oe.Fragment = e, oe.jsx = u, oe.jsxs = u, oe;
1473
1445
  }
@@ -1484,7 +1456,7 @@ var ae = {};
1484
1456
  var ct;
1485
1457
  function wr() {
1486
1458
  return ct || (ct = 1, process.env.NODE_ENV !== "production" && function() {
1487
- var r = D, s = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), V = Symbol.iterator, C = "@@iterator";
1459
+ var r = D, o = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), d = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), V = Symbol.iterator, C = "@@iterator";
1488
1460
  function k(t) {
1489
1461
  if (t === null || typeof t != "object")
1490
1462
  return null;
@@ -1866,7 +1838,7 @@ function wr() {
1866
1838
  var It = function(t, a, l, h, b, R, p) {
1867
1839
  var m = {
1868
1840
  // This tag allows us to uniquely identify this as a React Element
1869
- $$typeof: s,
1841
+ $$typeof: o,
1870
1842
  // Built-in properties that belong on the element
1871
1843
  type: t,
1872
1844
  key: a,
@@ -1921,7 +1893,7 @@ function wr() {
1921
1893
  var ke;
1922
1894
  ke = !1;
1923
1895
  function Pe(t) {
1924
- return typeof t == "object" && t !== null && t.$$typeof === s;
1896
+ return typeof t == "object" && t !== null && t.$$typeof === o;
1925
1897
  }
1926
1898
  function Je() {
1927
1899
  {
@@ -2037,7 +2009,7 @@ Check the top-level render call using <` + l + ">.");
2037
2009
  var $ = kt(b);
2038
2010
  $ ? m += $ : m += Je();
2039
2011
  var j;
2040
- t === null ? j = "null" : Oe(t) ? j = "array" : t !== void 0 && t.$$typeof === s ? (j = "<" + (G(t.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : j = typeof t, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, m);
2012
+ t === null ? j = "null" : Oe(t) ? j = "array" : t !== void 0 && t.$$typeof === o ? (j = "<" + (G(t.type) || "Unknown") + " />", m = " Did you accidentally export a JSX literal instead of a component?") : j = typeof t, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, m);
2041
2013
  }
2042
2014
  var L = Tt(t, a, l, b, R);
2043
2015
  if (L == null)
@@ -2073,8 +2045,8 @@ Check the top-level render call using <` + l + ">.");
2073
2045
  })(Sr);
2074
2046
  const Rr = Ae.jsx;
2075
2047
  function jr(r) {
2076
- const s = Gt(null), e = br(r), i = e.jsBridge, n = (f) => /* @__PURE__ */ Rr(s.Provider, { value: e, children: f.children }), c = () => {
2077
- const f = D.useContext(s);
2048
+ const o = Gt(null), e = br(r), i = e.jsBridge, n = (f) => /* @__PURE__ */ Rr(o.Provider, { value: e, children: f.children }), c = () => {
2049
+ const f = D.useContext(o);
2078
2050
  if (!f)
2079
2051
  throw new Error("LiveProvider never found.");
2080
2052
  return f;