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);