This commit is contained in:
yumoqing 2024-08-21 14:07:22 +08:00
parent 8e46c533fb
commit 7d25d29337

View File

@ -143,7 +143,6 @@ bricks.RTCClient = class extends bricks.VBox {
to:peer_info
}
this.peer_info = peer_info;
this.role = 'requester';
this.socket.send(JSON.stringify(d));
}
@ -231,16 +230,16 @@ bricks.RTCClient = class extends bricks.VBox {
console.log('offer branch exe');
break;
case 'answer':
console.log('answer: d.from=', d.from, 'peer_info=', self.peer_info);
if (d.from.id == self.peer_info.id){
console.log('answer: d.from=', d.from, 'peer_info=', this.peer_info);
if (d.from.id == this.peer_info.id){
var desc = new RTCSessionDescription(d.answer);
await this.pc.setRemoteDescription(desc);
console.log('answer branch exe');
}
break;
case 'iceCandidate':
console.log('iceCandidate: d.from=', d.from, 'peer_info=', self.peer_info);
if (d.from.id == self.peer_info.id){
console.log('iceCandidate: d.from=', d.from, 'peer_info=', this.peer_info);
if (d.from.id == this.peer_info.id){
var candidate = new RTCIceCandidate(d.candidate);
await this.pc.addIceCandidate(candidate);
console.log('iceCandidate branch exe');