@realsee/live 0.5.2-dev.7 → 0.5.2-dev.8

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.
@@ -118,6 +118,13 @@ export declare class Live<KeyframesSnapshot extends Record<string, any>> extends
118
118
  * @returns
119
119
  */
120
120
  exit: () => Promise<boolean>;
121
+ /**
122
+ * 关闭带看房间
123
+ * @param code
124
+ * @param reason
125
+ * @returns
126
+ */
127
+ close: () => Promise<boolean | undefined>;
121
128
  /**
122
129
  * 销毁带看
123
130
  * @returns
@@ -963,6 +963,10 @@ exports.WebSocketErrorType = void 0;
963
963
  */
964
964
  exports.WebSocketCloseError = void 0;
965
965
  (function (WebSocketCloseError) {
966
+ /**
967
+ * 正常关闭; 无论为何目的而创建,该链接都已成功完成任务。
968
+ */
969
+ WebSocketCloseError["Err_1000"] = "CLOSE_NORMAL";
966
970
  /**
967
971
  * 终端离开, 可能因为服务端错误, 也可能因为浏览器正从打开连接的页面跳转离开。
968
972
  */
@@ -998,6 +1002,9 @@ exports.WebSocketCloseError = void 0;
998
1002
  })(exports.WebSocketCloseError || (exports.WebSocketCloseError = {}));
999
1003
  function parseWSClsErr(code) {
1000
1004
  switch (code) {
1005
+ case 1000: {
1006
+ return exports.WebSocketCloseError.Err_1000;
1007
+ }
1001
1008
  case 1001: {
1002
1009
  return exports.WebSocketCloseError.Err_1001;
1003
1010
  }
@@ -3662,13 +3669,27 @@ class Live extends Subscribe$1 {
3662
3669
  return true;
3663
3670
  try {
3664
3671
  /** 退出强制关闭语音 */
3665
- (_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
3666
- yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
3672
+ yield ((_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit());
3667
3673
  }
3668
3674
  catch (e) {
3669
3675
  logger$1.warn(e);
3670
3676
  }
3671
- return yield this._controller.close('user exit');
3677
+ return yield this._controller.close();
3678
+ });
3679
+ /**
3680
+ * 关闭带看房间
3681
+ * @param code
3682
+ * @param reason
3683
+ * @returns
3684
+ */
3685
+ this.close = () => __awaiter$1(this, void 0, void 0, function* () {
3686
+ var _m, _o;
3687
+ if ((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.close_live_room) {
3688
+ return yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
3689
+ }
3690
+ else {
3691
+ return;
3692
+ }
3672
3693
  });
3673
3694
  /**
3674
3695
  * 销毁带看
@@ -3689,10 +3710,10 @@ class Live extends Subscribe$1 {
3689
3710
  });
3690
3711
  // 仅用于用户自己的麦克风控制
3691
3712
  this.toggleMicro = (microStatus) => __awaiter$1(this, void 0, void 0, function* () {
3692
- var _m, _o, _p;
3693
- if (!((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.control_own_micro))
3713
+ var _p, _q, _r;
3714
+ if (!((_q = (_p = this.selfInfo) === null || _p === void 0 ? void 0 : _p.permission) === null || _q === void 0 ? void 0 : _q.control_own_micro))
3694
3715
  return false;
3695
- const result = yield ((_p = this.$RTC) === null || _p === void 0 ? void 0 : _p.toggleMicro(microStatus));
3716
+ const result = yield ((_r = this.$RTC) === null || _r === void 0 ? void 0 : _r.toggleMicro(microStatus));
3696
3717
  if (result) {
3697
3718
  yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
3698
3719
  status: microStatus ? exports.MicroStatus.OPEN : exports.MicroStatus.CLOSE,
@@ -3707,12 +3728,12 @@ class Live extends Subscribe$1 {
3707
3728
  * @returns
3708
3729
  */
3709
3730
  this.forbidMicro = (microStatus, toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3710
- var _q, _r;
3731
+ var _s, _t;
3711
3732
  if (typeof this._options.canForbidUserMicro === 'function' &&
3712
3733
  !this._options.canForbidUserMicro(toUserIds)) {
3713
3734
  return false;
3714
3735
  }
3715
- if (!((_r = (_q = this.selfInfo) === null || _q === void 0 ? void 0 : _q.permission) === null || _r === void 0 ? void 0 : _r.control_other_micro)) {
3736
+ if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_micro)) {
3716
3737
  return false;
3717
3738
  }
3718
3739
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
@@ -3726,12 +3747,12 @@ class Live extends Subscribe$1 {
3726
3747
  * @returns
3727
3748
  */
3728
3749
  this.forbidSync = (sync, toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3729
- var _s, _t;
3750
+ var _u, _v;
3730
3751
  if (typeof this._options.canForbidUserSync === 'function' &&
3731
3752
  !this._options.canForbidUserSync(toUserIds)) {
3732
3753
  return false;
3733
3754
  }
3734
- if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_sync)) {
3755
+ if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.control_other_sync)) {
3735
3756
  return false;
3736
3757
  }
3737
3758
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
@@ -3742,12 +3763,12 @@ class Live extends Subscribe$1 {
3742
3763
  * @returns
3743
3764
  */
3744
3765
  this.kick = (toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3745
- var _u, _v;
3766
+ var _w, _x;
3746
3767
  if (typeof this._options.canForbidUserKick === 'function' &&
3747
3768
  !this._options.canForbidUserKick(toUserIds)) {
3748
3769
  return false;
3749
3770
  }
3750
- if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.change_other_status)) {
3771
+ if (!((_x = (_w = this.selfInfo) === null || _w === void 0 ? void 0 : _w.permission) === null || _x === void 0 ? void 0 : _x.change_other_status)) {
3751
3772
  return false;
3752
3773
  }
3753
3774
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserStatus, {