bugfix
This commit is contained in:
parent
dc3b05e33d
commit
88884d1bd3
@ -39,6 +39,9 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
this.add_widget(this.videobox);
|
this.add_widget(this.videobox);
|
||||||
this.pc;
|
this.pc;
|
||||||
this.onlineList= [];
|
this.onlineList= [];
|
||||||
|
this.socket = this.init_websocket();
|
||||||
|
}
|
||||||
|
init_websocket(){
|
||||||
this.socket = new WebSocket(this.signaling_url);
|
this.socket = new WebSocket(this.signaling_url);
|
||||||
this.socket.onmessage = this.signaling_message_handle.bind(this);
|
this.socket.onmessage = this.signaling_message_handle.bind(this);
|
||||||
this.socket.onopen = this.signaling_login.bind(this);
|
this.socket.onopen = this.signaling_login.bind(this);
|
||||||
@ -277,6 +280,11 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
console.log(d.type, 'no branch defined');
|
console.log(d.type, 'no branch defined');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
console.log('signal_status=', this.pc.RTCSignalingState,
|
||||||
|
'iceconnectstate=', this.pc.RTCIceConnectionState,
|
||||||
|
'connectstate=', this.pc.connectionState,
|
||||||
|
'peerConnectionState=', this.pc.RTCPeerConnectionState,
|
||||||
|
'icegatheringstate=', this.pc.RTCIceGatheringState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建 PeerConnection
|
// 创建 PeerConnection
|
||||||
@ -304,6 +312,7 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
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.oniceconnectionstatechange = this.ice_statechange.bind(this);
|
||||||
this.pc.onicegatheringstatechange = this.ice_g_statechange.bind(this);
|
this.pc.onicegatheringstatechange = this.ice_g_statechange.bind(this);
|
||||||
|
this.pc.onconnectionstatechange = this.connection_statechange.bind(this);
|
||||||
|
|
||||||
// 处理远程流添加
|
// 处理远程流添加
|
||||||
this.pc.ontrack = event => {
|
this.pc.ontrack = event => {
|
||||||
@ -317,13 +326,16 @@ bricks.RTCClient = class extends bricks.VBox {
|
|||||||
console.log('createPeerConnection() finished');
|
console.log('createPeerConnection() finished');
|
||||||
}
|
}
|
||||||
async ice_statechange(event){
|
async ice_statechange(event){
|
||||||
console.log(`oniceconnectionstatechange, pc.iceConnectionState is ${this.pc.iceConnectionState}.`)
|
console.log(`oniceconnectionstatechange, pc.iceConnectionState is ${this.pc.iceConnectionState}.`);
|
||||||
if (this.pc.iceConnectionState == 'disconnected'){
|
if (this.pc.iceConnectionState === 'disconnected'){
|
||||||
if (this.role == 'requester'){
|
if (this.role == 'requester'){
|
||||||
send_offer();
|
await send_offer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async connection_statechange(event){
|
||||||
|
console.log(`onconnectionstatechange, pc.connectionState is ${this.pc.connectionState}.`);
|
||||||
|
}
|
||||||
ice_g_statechange(event){
|
ice_g_statechange(event){
|
||||||
console.log(`onicegatheringstatechange, pc.iceGatheringState is ${this.pc.iceGatheringState}.`);
|
console.log(`onicegatheringstatechange, pc.iceGatheringState is ${this.pc.iceGatheringState}.`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user