@realsee/live 0.6.8 → 0.6.10

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
@@ -452,12 +452,9 @@ class nt extends Me {
452
452
  o(this, "micro", !1);
453
453
  o(this, "voiceId", "");
454
454
  o(this, "options");
455
- this.options = { jsBridge: e, getVoiceSign: i }, this.jsBridge.webViewType !== "WxMiniProgramWebView" && this.jsBridge.callAndListen(
456
- "live/userVolumes",
457
- (n) => {
458
- this.emit("userVolumes", n);
459
- }
460
- ), this.jsBridge.callAndListen("live/weakNetwork", (n) => {
455
+ this.options = { jsBridge: e, getVoiceSign: i }, this.jsBridge.webViewType !== "WxMiniProgramWebView" && this.jsBridge.callAndListen("live/userVolumes", (n) => {
456
+ this.emit("userVolumes", n);
457
+ }), this.jsBridge.callAndListen("live/weakNetwork", (n) => {
461
458
  n && this.emit("weakNetwork");
462
459
  });
463
460
  }
@@ -467,29 +464,20 @@ class nt extends Me {
467
464
  async join(e) {
468
465
  try {
469
466
  this.emit("joinWillStart");
470
- const { sdkAppId: i, userId: n, userSig: c } = await this.options.getVoiceSign(
471
- e
472
- );
467
+ const { sdkAppId: i, userId: n, userSig: c } = await this.options.getVoiceSign(e);
473
468
  if (!(Boolean(i) && Boolean(n) && Boolean(c)))
474
469
  return this.emit("error", new Error("加入房间失败:rtc 签名请求异常")), this.joined = !1, this.joined;
475
470
  this.type = e.type;
476
471
  const [u, d] = await this.jsBridge.callAndBackfeed(
477
- `live/join?sdkAppID=${i}&userID=${n}&roomID=${Number(
478
- e.voiceId
479
- )}&userSig=${c}`
472
+ `live/join?sdkAppID=${i}&userID=${n}&roomID=${Number(e.voiceId)}&userSig=${c}`
480
473
  );
481
- return u ? u.code === lt.Success ? (this.emit("joined"), this.joined = !0) : (this.emit("error", u), this.joined = !1) : (this.emit(
482
- "error",
483
- d || new Error("加入房间失败:未知异常。")
484
- ), this.joined = !1), this.joined;
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;
485
475
  } catch (i) {
486
476
  return this.emit("error", new Error("加入房间失败:" + i.message)), this.joined = !1, this.joined;
487
477
  }
488
478
  }
489
479
  async quit() {
490
- const [e, i] = await this.jsBridge.callAndBackfeed(
491
- "live/quit"
492
- );
480
+ const [e, i] = await this.jsBridge.callAndBackfeed("live/quit");
493
481
  return e === null && this.emit("error", i || new Error("退出房间失败:未知异常。")), this.joined = !1, !!e;
494
482
  }
495
483
  async detectMicro() {
@@ -497,9 +485,7 @@ class nt extends Me {
497
485
  return e === null ? (this.emit("error", i || new Error("麦克风监测异常!")), !1) : e;
498
486
  }
499
487
  async toggleMicro(e) {
500
- const [i, n] = await this.jsBridge.callAndBackfeed(
501
- `live/toggleMicro?flag=${e ? 1 : 0}`
502
- );
488
+ const [i, n] = await this.jsBridge.callAndBackfeed(`live/toggleMicro?flag=${e ? 1 : 0}`);
503
489
  return i === null ? (this.emit("error", n || new Error("麦克风监测异常!")), !1) : (this.micro = i, i);
504
490
  }
505
491
  shock() {
@@ -1196,15 +1182,11 @@ class yr extends ue {
1196
1182
  * @param reason
1197
1183
  * @returns
1198
1184
  */
1199
- o(this, "close", async () => {
1200
- var e, i;
1201
- if ((i = (e = this.selfInfo) == null ? void 0 : e.permission) != null && i.close_live_room)
1202
- return await this.updateStatus(
1203
- q.RoomChange,
1204
- H.RoomClose,
1205
- {}
1206
- );
1207
- });
1185
+ o(this, "close", async () => await this.updateStatus(
1186
+ q.RoomChange,
1187
+ H.RoomClose,
1188
+ {}
1189
+ ));
1208
1190
  /**
1209
1191
  * 销毁带看
1210
1192
  * @returns