@realsee/live 0.5.2-dev.6 → 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.
@@ -954,6 +954,10 @@ var WebSocketErrorType;
954
954
  */
955
955
  var WebSocketCloseError;
956
956
  (function (WebSocketCloseError) {
957
+ /**
958
+ * 正常关闭; 无论为何目的而创建,该链接都已成功完成任务。
959
+ */
960
+ WebSocketCloseError["Err_1000"] = "CLOSE_NORMAL";
957
961
  /**
958
962
  * 终端离开, 可能因为服务端错误, 也可能因为浏览器正从打开连接的页面跳转离开。
959
963
  */
@@ -989,6 +993,9 @@ var WebSocketCloseError;
989
993
  })(WebSocketCloseError || (WebSocketCloseError = {}));
990
994
  function parseWSClsErr(code) {
991
995
  switch (code) {
996
+ case 1000: {
997
+ return WebSocketCloseError.Err_1000;
998
+ }
992
999
  case 1001: {
993
1000
  return WebSocketCloseError.Err_1001;
994
1001
  }
@@ -3653,13 +3660,27 @@ class Live extends Subscribe$1 {
3653
3660
  return true;
3654
3661
  try {
3655
3662
  /** 退出强制关闭语音 */
3656
- (_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
3657
- yield this.updateStatus(BuiltinEventType.RoomChange, BuiltinActionType.RoomClose, {});
3663
+ yield ((_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit());
3658
3664
  }
3659
3665
  catch (e) {
3660
3666
  logger$1.warn(e);
3661
3667
  }
3662
- return yield this._controller.close('user exit');
3668
+ return yield this._controller.close();
3669
+ });
3670
+ /**
3671
+ * 关闭带看房间
3672
+ * @param code
3673
+ * @param reason
3674
+ * @returns
3675
+ */
3676
+ this.close = () => __awaiter$1(this, void 0, void 0, function* () {
3677
+ var _m, _o;
3678
+ if ((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.close_live_room) {
3679
+ return yield this.updateStatus(BuiltinEventType.RoomChange, BuiltinActionType.RoomClose, {});
3680
+ }
3681
+ else {
3682
+ return;
3683
+ }
3663
3684
  });
3664
3685
  /**
3665
3686
  * 销毁带看
@@ -3680,10 +3701,10 @@ class Live extends Subscribe$1 {
3680
3701
  });
3681
3702
  // 仅用于用户自己的麦克风控制
3682
3703
  this.toggleMicro = (microStatus) => __awaiter$1(this, void 0, void 0, function* () {
3683
- var _m, _o, _p;
3684
- if (!((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.control_own_micro))
3704
+ var _p, _q, _r;
3705
+ if (!((_q = (_p = this.selfInfo) === null || _p === void 0 ? void 0 : _p.permission) === null || _q === void 0 ? void 0 : _q.control_own_micro))
3685
3706
  return false;
3686
- const result = yield ((_p = this.$RTC) === null || _p === void 0 ? void 0 : _p.toggleMicro(microStatus));
3707
+ const result = yield ((_r = this.$RTC) === null || _r === void 0 ? void 0 : _r.toggleMicro(microStatus));
3687
3708
  if (result) {
3688
3709
  yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserMicroStatus, {
3689
3710
  status: microStatus ? MicroStatus.OPEN : MicroStatus.CLOSE,
@@ -3698,12 +3719,12 @@ class Live extends Subscribe$1 {
3698
3719
  * @returns
3699
3720
  */
3700
3721
  this.forbidMicro = (microStatus, toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3701
- var _q, _r;
3722
+ var _s, _t;
3702
3723
  if (typeof this._options.canForbidUserMicro === 'function' &&
3703
3724
  !this._options.canForbidUserMicro(toUserIds)) {
3704
3725
  return false;
3705
3726
  }
3706
- if (!((_r = (_q = this.selfInfo) === null || _q === void 0 ? void 0 : _q.permission) === null || _r === void 0 ? void 0 : _r.control_other_micro)) {
3727
+ if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_micro)) {
3707
3728
  return false;
3708
3729
  }
3709
3730
  return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserMicroStatus, {
@@ -3717,12 +3738,12 @@ class Live extends Subscribe$1 {
3717
3738
  * @returns
3718
3739
  */
3719
3740
  this.forbidSync = (sync, toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3720
- var _s, _t;
3741
+ var _u, _v;
3721
3742
  if (typeof this._options.canForbidUserSync === 'function' &&
3722
3743
  !this._options.canForbidUserSync(toUserIds)) {
3723
3744
  return false;
3724
3745
  }
3725
- if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_sync)) {
3746
+ if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.control_other_sync)) {
3726
3747
  return false;
3727
3748
  }
3728
3749
  return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
@@ -3733,12 +3754,12 @@ class Live extends Subscribe$1 {
3733
3754
  * @returns
3734
3755
  */
3735
3756
  this.kick = (toUserIds) => __awaiter$1(this, void 0, void 0, function* () {
3736
- var _u, _v;
3757
+ var _w, _x;
3737
3758
  if (typeof this._options.canForbidUserKick === 'function' &&
3738
3759
  !this._options.canForbidUserKick(toUserIds)) {
3739
3760
  return false;
3740
3761
  }
3741
- if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.change_other_status)) {
3762
+ if (!((_x = (_w = this.selfInfo) === null || _w === void 0 ? void 0 : _w.permission) === null || _x === void 0 ? void 0 : _x.change_other_status)) {
3742
3763
  return false;
3743
3764
  }
3744
3765
  return yield this.updateStatus(BuiltinEventType.UserChange, BuiltinActionType.UserStatus, {
@@ -3757,6 +3778,7 @@ class Live extends Subscribe$1 {
3757
3778
  })();
3758
3779
  // 第二步检查getVoiceSign
3759
3780
  this._options.getVoiceSign = (_a = opts.getVoiceSign) !== null && _a !== void 0 ? _a : unimplementedGetVoiceSign;
3781
+ this._options.autoPlayConfirm = opts.autoPlayConfirm;
3760
3782
  // 第二步检查rtc
3761
3783
  this._options.rtc = (() => {
3762
3784
  // 优先取rtc实例
@@ -3790,7 +3812,9 @@ class Live extends Subscribe$1 {
3790
3812
  }
3791
3813
  case RTCType.RealseeBrowserRTC: {
3792
3814
  // 内置的 RealseeBrowserRTC
3793
- logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
3815
+ if (!this._options.autoPlayConfirm) {
3816
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances');
3817
+ }
3794
3818
  return new BrowserRTC({
3795
3819
  getVoiceSign: this._options.getVoiceSign,
3796
3820
  autoPlayConfirm: this._options.autoPlayConfirm,