blue
2 years ago
committed by
Gitee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with
19 additions and
4 deletions
-
im-ui/src/api/rtcPrivateApi.js
-
im-ui/src/components/rtc/RtcGroupVideo.vue
-
im-ui/src/components/rtc/RtcPrivateVideo.vue
|
|
|
@ -7,7 +7,10 @@ RtcPrivateApi.prototype.call = function(uid, mode, offer) { |
|
|
|
return http({ |
|
|
|
url: `/webrtc/private/call?uid=${uid}&mode=${mode}`, |
|
|
|
method: 'post', |
|
|
|
data: JSON.stringify(offer) |
|
|
|
data: JSON.stringify(offer), |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@ -15,7 +18,10 @@ RtcPrivateApi.prototype.accept = function(uid, answer) { |
|
|
|
return http({ |
|
|
|
url: `/webrtc/private/accept?uid=${uid}`, |
|
|
|
method: 'post', |
|
|
|
data: JSON.stringify(answer) |
|
|
|
data: JSON.stringify(answer), |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
@ -52,7 +58,10 @@ RtcPrivateApi.prototype.sendCandidate = function(uid, candidate) { |
|
|
|
return http({ |
|
|
|
url: `/webrtc/private/candidate?uid=${uid}`, |
|
|
|
method: 'post', |
|
|
|
data: JSON.stringify(candidate) |
|
|
|
data: JSON.stringify(candidate), |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -29,6 +29,9 @@ |
|
|
|
methods: { |
|
|
|
open() { |
|
|
|
this.isShow = true; |
|
|
|
}, |
|
|
|
onRTCMessage(){ |
|
|
|
//this.isShow = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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() { |
|
|
|
|