Kaynağa Gözat

fix: 呼叫方如果没有摄像头,不允许发起呼叫

blue 1 yıl önce
ebeveyn
işleme
dd88273b7d
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4 1
      im-ui/src/components/rtc/RtcPrivateVideo.vue

+ 4 - 1
im-ui/src/components/rtc/RtcPrivateVideo.vue

@@ -114,7 +114,7 @@
 				// 启动心跳
 				this.startHeartBeat();
 				// 打开摄像头
-				this.openStream().finally(() => {
+				this.openStream().then(() => {
 					this.webrtc.setStream(this.localStream);
 					this.webrtc.createOffer().then((offer) => {
 						// 发起呼叫
@@ -127,6 +127,9 @@
 							this.close();
 						})
 					})
+				}).catch(()=>{
+					// 呼叫方必须能打开摄像头,否则无法正常建立连接
+					this.close();
 				})
 			},
 			onAccept() {