This commit is contained in:
yumoqing 2024-08-21 16:20:45 +08:00
parent 8d42deb7a7
commit b218d7e62e

View File

@ -156,12 +156,13 @@ bricks.RTCClient = class extends bricks.VBox {
})); }));
} }
send_candidate(peer_info, event){ send_candidate(peer_info, event){
console.log('send_candidate(), event=', event);
if (event.candidate) { if (event.candidate) {
var candidate = event.candidate.candidate;
console.log('send_candidate(), candidate=', candidate);
this.socket.send(JSON.stringify({ this.socket.send(JSON.stringify({
type: 'iceCandidate', type: 'iceCandidate',
to:peer_info, to:peer_info,
candidate: event.candidate candidate: candidate
})); }));
} }
} }
@ -250,8 +251,8 @@ bricks.RTCClient = class extends bricks.VBox {
break; break;
case 'iceCandidate': case 'iceCandidate':
if (d.from.id == this.peer_info.id){ if (d.from.id == this.peer_info.id){
// var candidate = new RTCIceCandidate(d.candidate); var candidate = new RTCIceCandidate(d.candidate);
await this.pc.addIceCandidate(d.candidate); await this.pc.addIceCandidate(candidate);
console.log('iceCandidate branch exe'); console.log('iceCandidate branch exe');
} }
break; break;