@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.
@@ -49064,6 +49064,10 @@
49064
49064
  */
49065
49065
  exports.WebSocketCloseError = void 0;
49066
49066
  (function (WebSocketCloseError) {
49067
+ /**
49068
+ * 正常关闭; 无论为何目的而创建,该链接都已成功完成任务。
49069
+ */
49070
+ WebSocketCloseError["Err_1000"] = "CLOSE_NORMAL";
49067
49071
  /**
49068
49072
  * 终端离开, 可能因为服务端错误, 也可能因为浏览器正从打开连接的页面跳转离开。
49069
49073
  */
@@ -49099,6 +49103,9 @@
49099
49103
  })(exports.WebSocketCloseError || (exports.WebSocketCloseError = {}));
49100
49104
  function parseWSClsErr(code) {
49101
49105
  switch (code) {
49106
+ case 1000: {
49107
+ return exports.WebSocketCloseError.Err_1000;
49108
+ }
49102
49109
  case 1001: {
49103
49110
  return exports.WebSocketCloseError.Err_1001;
49104
49111
  }
@@ -51735,13 +51742,27 @@
51735
51742
  return true;
51736
51743
  try {
51737
51744
  /** 退出强制关闭语音 */
51738
- (_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
51739
- yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
51745
+ yield ((_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit());
51740
51746
  }
51741
51747
  catch (e) {
51742
51748
  logger$1.warn(e);
51743
51749
  }
51744
- return yield this._controller.close('user exit');
51750
+ return yield this._controller.close();
51751
+ });
51752
+ /**
51753
+ * 关闭带看房间
51754
+ * @param code
51755
+ * @param reason
51756
+ * @returns
51757
+ */
51758
+ this.close = () => __awaiter$10(this, void 0, void 0, function* () {
51759
+ var _m, _o;
51760
+ if ((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.close_live_room) {
51761
+ return yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
51762
+ }
51763
+ else {
51764
+ return;
51765
+ }
51745
51766
  });
51746
51767
  /**
51747
51768
  * 销毁带看
@@ -51762,10 +51783,10 @@
51762
51783
  });
51763
51784
  // 仅用于用户自己的麦克风控制
51764
51785
  this.toggleMicro = (microStatus) => __awaiter$10(this, void 0, void 0, function* () {
51765
- var _m, _o, _p;
51766
- if (!((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.control_own_micro))
51786
+ var _p, _q, _r;
51787
+ if (!((_q = (_p = this.selfInfo) === null || _p === void 0 ? void 0 : _p.permission) === null || _q === void 0 ? void 0 : _q.control_own_micro))
51767
51788
  return false;
51768
- const result = yield ((_p = this.$RTC) === null || _p === void 0 ? void 0 : _p.toggleMicro(microStatus));
51789
+ const result = yield ((_r = this.$RTC) === null || _r === void 0 ? void 0 : _r.toggleMicro(microStatus));
51769
51790
  if (result) {
51770
51791
  yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
51771
51792
  status: microStatus ? exports.MicroStatus.OPEN : exports.MicroStatus.CLOSE,
@@ -51780,12 +51801,12 @@
51780
51801
  * @returns
51781
51802
  */
51782
51803
  this.forbidMicro = (microStatus, toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
51783
- var _q, _r;
51804
+ var _s, _t;
51784
51805
  if (typeof this._options.canForbidUserMicro === 'function' &&
51785
51806
  !this._options.canForbidUserMicro(toUserIds)) {
51786
51807
  return false;
51787
51808
  }
51788
- if (!((_r = (_q = this.selfInfo) === null || _q === void 0 ? void 0 : _q.permission) === null || _r === void 0 ? void 0 : _r.control_other_micro)) {
51809
+ if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_micro)) {
51789
51810
  return false;
51790
51811
  }
51791
51812
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
@@ -51799,12 +51820,12 @@
51799
51820
  * @returns
51800
51821
  */
51801
51822
  this.forbidSync = (sync, toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
51802
- var _s, _t;
51823
+ var _u, _v;
51803
51824
  if (typeof this._options.canForbidUserSync === 'function' &&
51804
51825
  !this._options.canForbidUserSync(toUserIds)) {
51805
51826
  return false;
51806
51827
  }
51807
- if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_sync)) {
51828
+ if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.control_other_sync)) {
51808
51829
  return false;
51809
51830
  }
51810
51831
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
@@ -51815,12 +51836,12 @@
51815
51836
  * @returns
51816
51837
  */
51817
51838
  this.kick = (toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
51818
- var _u, _v;
51839
+ var _w, _x;
51819
51840
  if (typeof this._options.canForbidUserKick === 'function' &&
51820
51841
  !this._options.canForbidUserKick(toUserIds)) {
51821
51842
  return false;
51822
51843
  }
51823
- if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.change_other_status)) {
51844
+ if (!((_x = (_w = this.selfInfo) === null || _w === void 0 ? void 0 : _w.permission) === null || _x === void 0 ? void 0 : _x.change_other_status)) {
51824
51845
  return false;
51825
51846
  }
51826
51847
  return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserStatus, {
@@ -51839,6 +51860,7 @@
51839
51860
  })();
51840
51861
  // 第二步检查getVoiceSign
51841
51862
  this._options.getVoiceSign = (_a = opts.getVoiceSign) !== null && _a !== void 0 ? _a : unimplementedGetVoiceSign;
51863
+ this._options.autoPlayConfirm = opts.autoPlayConfirm;
51842
51864
  // 第二步检查rtc
51843
51865
  this._options.rtc = (() => {
51844
51866
  // 优先取rtc实例
@@ -51872,7 +51894,9 @@
51872
51894
  }
51873
51895
  case exports.RTCType.RealseeBrowserRTC: {
51874
51896
  // 内置的 RealseeBrowserRTC
51875
- logger$1.error('autoPlayConfirm method must be passed when using built-in RTC instances');
51897
+ if (!this._options.autoPlayConfirm) {
51898
+ logger$1.error('autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances');
51899
+ }
51876
51900
  return new BrowserRTC({
51877
51901
  getVoiceSign: this._options.getVoiceSign,
51878
51902
  autoPlayConfirm: this._options.autoPlayConfirm,