Browse Source

视频聊天功能-开发中

master
xie.bx 3 years ago
parent
commit
a38adc0db8
  1. 16
      im-ui/src/components/chat/ChatPrivateVideo.vue

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

@ -49,9 +49,9 @@
candidates: [], candidates: [],
configuration: { configuration: {
iceServers: [{ iceServers: [{
'urls': 'turn:www.boxim.online:3478', 'url': 'turn:www.boxim.online:3478',
'credential': "admin123", 'credential': 'admin123',
'username': "admin" 'username': 'admin'
}] }]
} }
} }
@ -177,11 +177,11 @@
this.peerConnection.createOffer((offer) => { this.peerConnection.createOffer((offer) => {
this.peerConnection.setLocalDescription(offer); this.peerConnection.setLocalDescription(offer);
console.log("发送offer") console.log("发送offer")
console.log(offer) console.log(JSON.stringify(offer))
this.$http({ this.$http({
url: `/webrtc/private/call?uid=${this.friend.id}`, url: `/webrtc/private/call?uid=${this.friend.id}`,
method: 'post', method: 'post',
data: offer data: JSON.stringify(offer)
}).then(() => { }).then(() => {
this.loading = true; this.loading = true;
this.state = 'CONNECTING'; this.state = 'CONNECTING';
@ -198,12 +198,12 @@
this.peerConnection.setRemoteDescription(new RTCSessionDescription(offer)); this.peerConnection.setRemoteDescription(new RTCSessionDescription(offer));
this.peerConnection.createAnswer((answer) => { this.peerConnection.createAnswer((answer) => {
console.log("发送answer") console.log("发送answer")
console.log(answer) console.log(JSON.stringify(answer))
this.peerConnection.setLocalDescription(answer); this.peerConnection.setLocalDescription(answer);
this.$http({ this.$http({
url: `/webrtc/private/accept?uid=${this.friend.id}`, url: `/webrtc/private/accept?uid=${this.friend.id}`,
method: 'post', method: 'post',
data: answer data: JSON.stringify(answer)
}) })
this.state = 'CONNECTED'; this.state = 'CONNECTED';
}, },
@ -238,7 +238,7 @@
this.$http({ this.$http({
url: `/webrtc/private/candidate?uid=${this.friend.id}`, url: `/webrtc/private/candidate?uid=${this.friend.id}`,
method: 'post', method: 'post',
data: candidate data: JSON.stringify(candidate)
}) })
}, },
close() { close() {

Loading…
Cancel
Save