From 7d25d29337d032307e18ad6d3ae1aa5bbe08ec1f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 21 Aug 2024 14:07:22 +0800 Subject: [PATCH] bugfix --- bricks/rtc.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bricks/rtc.js b/bricks/rtc.js index 377d29e..f7e06b4 100644 --- a/bricks/rtc.js +++ b/bricks/rtc.js @@ -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');