Browse Source

视频聊天功能-开发中

master
xie.bx 3 years ago
parent
commit
57d85508da
  1. 14
      im-ui/src/components/chat/ChatPrivateVideo.vue

14
im-ui/src/components/chat/ChatPrivateVideo.vue

@ -48,7 +48,11 @@
state: 'NOT_CONNECTED',
candidates: [],
configuration: {
iceServers: [{
'urls': 'turn:www.boxim.online:3478',
'credential': "admin123",
'username': "admin"
}]
}
}
},
@ -134,6 +138,8 @@
},
handleMessage(msg) {
if (msg.type == this.$enums.MESSAGE_TYPE.RTC_ACCEPT) {
console.log("接收answer")
console.log(msg.content)
this.peerConnection.setRemoteDescription(new RTCSessionDescription(JSON.parse(msg.content)));
//
this.loading = false;
@ -170,6 +176,8 @@
call() {
this.peerConnection.createOffer((offer) => {
this.peerConnection.setLocalDescription(offer);
console.log("发送offer")
console.log(offer)
this.$http({
url: `/webrtc/private/call?uid=${this.friend.id}`,
method: 'post',
@ -185,8 +193,12 @@
},
accept(offer) {
console.log("接收到offer")
console.log(offer)
this.peerConnection.setRemoteDescription(new RTCSessionDescription(offer));
this.peerConnection.createAnswer((answer) => {
console.log("发送answer")
console.log(answer)
this.peerConnection.setLocalDescription(answer);
this.$http({
url: `/webrtc/private/accept?uid=${this.friend.id}`,

Loading…
Cancel
Save