This commit is contained in:
yumoqing 2024-08-21 13:58:32 +08:00
parent bb152aaa1b
commit 8e46c533fb

View File

@ -59,7 +59,7 @@ bricks.RTCClient = class extends bricks.VBox {
url:bricks_resource('imgs/free_phone.png') url:bricks_resource('imgs/free_phone.png')
},{ },{
state:'using', state:'using',
url:bricks_resource('img/using_phone.png') url:bricks_resource('imgs/using_phone.png')
} }
], ],
state:'free', state:'free',
@ -231,14 +231,16 @@ bricks.RTCClient = class extends bricks.VBox {
console.log('offer branch exe'); console.log('offer branch exe');
break; break;
case 'answer': case 'answer':
if (d.from == self.peer_info){ console.log('answer: d.from=', d.from, 'peer_info=', self.peer_info);
if (d.from.id == self.peer_info.id){
var desc = new RTCSessionDescription(d.answer); var desc = new RTCSessionDescription(d.answer);
await this.pc.setRemoteDescription(desc); await this.pc.setRemoteDescription(desc);
console.log('answer branch exe'); console.log('answer branch exe');
} }
break; break;
case 'iceCandidate': case 'iceCandidate':
if (d.from == self.peer_info){ console.log('iceCandidate: d.from=', d.from, 'peer_info=', self.peer_info);
if (d.from.id == self.peer_info.id){
var candidate = new RTCIceCandidate(d.candidate); var candidate = new RTCIceCandidate(d.candidate);
await this.pc.addIceCandidate(candidate); await this.pc.addIceCandidate(candidate);
console.log('iceCandidate branch exe'); console.log('iceCandidate branch exe');