From 4a48b85fc1408dad326f4f302ffa96c64a16fdc5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 21 Aug 2024 17:34:18 +0800 Subject: [PATCH] bugfix --- bricks/rtc.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bricks/rtc.js b/bricks/rtc.js index 5803595..80d08a5 100644 --- a/bricks/rtc.js +++ b/bricks/rtc.js @@ -280,9 +280,7 @@ bricks.RTCClient = class extends bricks.VBox { this.peer_w.set_text(to_info.name); await this.getLocalStream(); const configuration = { - iceServers: [ - { urls: this.ice_url } - ] + iceServers: this.ice_servers, }; console.log('configuration=', configuration); this.pc = new RTCPeerConnection(configuration); @@ -297,10 +295,6 @@ bricks.RTCClient = class extends bricks.VBox { console.log('pc is null'); return; } - if (this.role == 'requester'){ - await this.send_offer(); - } - // 处理 ICE 候选 this.pc.onicecandidate = this.send_candidate.bind(this, to_info); @@ -308,6 +302,11 @@ bricks.RTCClient = class extends bricks.VBox { this.pc.ontrack = event => { this.remoteVideo.set_stream(event.streams[0]); }; + + if (this.role == 'requester'){ + await this.send_offer(); + } + console.log('createPeerConnection() finished'); } }