This commit is contained in:
yumoqing 2024-08-22 14:18:34 +08:00
parent abc6c7565a
commit 219b0014fb

View File

@ -302,6 +302,8 @@ bricks.RTCClient = class extends bricks.VBox {
} }
// 处理 ICE 候选 // 处理 ICE 候选
this.pc.onicecandidate = this.send_candidate.bind(this, to_info); 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 => { this.pc.ontrack = event => {
@ -314,6 +316,12 @@ bricks.RTCClient = class extends bricks.VBox {
console.log('createPeerConnection() finished'); 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); bricks.Factory.register('RTCClient', bricks.RTCClient);