From 219b0014fb81e6027eb5a81361dbebfe4614cf61 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 22 Aug 2024 14:18:34 +0800 Subject: [PATCH] bugfix --- bricks/rtc.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bricks/rtc.js b/bricks/rtc.js index e932b0b..543038d 100644 --- a/bricks/rtc.js +++ b/bricks/rtc.js @@ -302,6 +302,8 @@ bricks.RTCClient = class extends bricks.VBox { } // 处理 ICE 候选 this.pc.onicecandidate = this.send_candidate.bind(this, to_info); + this.pc.oniceconnectionstatechange = this.ice_statechange.bind(this); + this.pc.onicegatheringstatechange = this.ice_g_statechange.bind(this); // 处理远程流添加 this.pc.ontrack = event => { @@ -314,6 +316,12 @@ bricks.RTCClient = class extends bricks.VBox { console.log('createPeerConnection() finished'); } + ice_statechange(event){ + console.log(`oniceconnectionstatechange, pc.iceConnectionState is ${this.pc.iceConnectionState}.`) + } + ice_g_statechange(event){ + console.log(`onicegatheringstatechange, pc.iceGatheringState is ${pc.iceGatheringState}.`); + } } bricks.Factory.register('RTCClient', bricks.RTCClient);