@realsee/live 0.5.0-alpha.7 → 0.5.0-alpha.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.
@@ -609,7 +609,7 @@ class VRWebViewRTC extends CoreRTC {
609
609
  this.voiceId = '';
610
610
  this.options = { jsBridge, getVoiceSign };
611
611
  // TO-DO: 在微信小程序下有个音量上报的BUG会导致消息体过大从而jsbridge异常断开
612
- if (this.jsBridge.webViewType !== "WxMiniProgramWebView") {
612
+ if (this.jsBridge.webViewType !== 'WxMiniProgramWebView') {
613
613
  this.jsBridge.callAndListen('live/userVolumes', (userVolumes) => {
614
614
  this.emit('userVolumes', userVolumes);
615
615
  });
@@ -624,25 +624,37 @@ class VRWebViewRTC extends CoreRTC {
624
624
  }
625
625
  join(options) {
626
626
  return __awaiter(this, void 0, void 0, function* () {
627
- this.emit('joinWillStart');
628
- const { sdkAppId, userId, userSig } = yield this.options.getVoiceSign(options);
629
- this.type = options.type;
630
- const [res, error] = yield this.jsBridge.callAndBackfeed(`live/join?sdkAppID=${sdkAppId}&userID=${userId}&roomID=${Number(options.voiceId)}&userSig=${userSig}`);
631
- if (!res) {
632
- this.emit('error', error ? error : new Error('加入房间失败:未知异常。'));
633
- this.joined = false;
634
- }
635
- else {
636
- if (res.code === RTCJoinedInfoCodeEnum.Success) {
637
- this.emit('joined');
638
- this.joined = true;
627
+ try {
628
+ this.emit('joinWillStart');
629
+ const { sdkAppId, userId, userSig } = yield this.options.getVoiceSign(options);
630
+ if (!(Boolean(sdkAppId) && Boolean(userId) && Boolean(userSig))) {
631
+ this.emit('error', new Error('加入房间失败:rtc 签名请求异常'));
632
+ this.joined = false;
633
+ return this.joined;
639
634
  }
640
- else {
641
- this.emit('error', res);
635
+ this.type = options.type;
636
+ const [res, error] = yield this.jsBridge.callAndBackfeed(`live/join?sdkAppID=${sdkAppId}&userID=${userId}&roomID=${Number(options.voiceId)}&userSig=${userSig}`);
637
+ if (!res) {
638
+ this.emit('error', error ? error : new Error('加入房间失败:未知异常。'));
642
639
  this.joined = false;
643
640
  }
641
+ else {
642
+ if (res.code === RTCJoinedInfoCodeEnum.Success) {
643
+ this.emit('joined');
644
+ this.joined = true;
645
+ }
646
+ else {
647
+ this.emit('error', res);
648
+ this.joined = false;
649
+ }
650
+ }
651
+ return this.joined;
652
+ }
653
+ catch (e) {
654
+ this.emit('error', new Error('加入房间失败:' + e.message));
655
+ this.joined = false;
656
+ return this.joined;
644
657
  }
645
- return this.joined;
646
658
  });
647
659
  }
648
660
  quit() {