This commit is contained in:
yumoqing 2024-08-20 17:56:50 +08:00
parent 797686e3d3
commit 1fd7b38e44

View File

@ -200,9 +200,11 @@ bricks.RTCClient = class extends bricks.VBox {
switch (d.type){
case 'onlineList':
this.onlineList = d.onlineList;
console.log('onlineList branch exe');
break;
case 'callRequest':
this.need_conform_call(d.from);
console.log('callRequest branch exe');
break;
case 'offer':
var offer = new RTCSessionDescription(d.offer);
@ -213,26 +215,36 @@ bricks.RTCClient = class extends bricks.VBox {
answer:answer,
to:this.peer_info
}));
console.log('offer branch exe');
break;
case 'answer':
if (d.from == self.peer_info){
var desc = new RTCSessionDescription(d.answer);
this.peerConnection.setRemoteDescription(desc);
var desc = new RTCSessionDescription(d.answer);
this.peerConnection.setRemoteDescription(desc);
}
console.log('answer branch exe');
break;
case 'iceCandidate':
if (d.from == self.peer_info){
var candidate = new RTCIceCandidate(d.candidate);
this.peerConnection.addIceCandidate(candidate);
var candidate = new RTCIceCandidate(d.candidate);
this.peerConnection.addIceCandidate(candidate);
}
console.log('iceCandidate branch exe');
break;
case 'callAccepted':
await this.createPeerConnection(this.peer_info);
console.log('callAccepted branch exe');
break;
case 'callRejected':
this.peer_info = null;
console.log('callRejected branch exe');
break;
case 'disconnect':
this.call_close(true);
console.log('disconnect branch exe');
break;
default:
console.log(d.type, 'no branch defined');
break;
}
}