bugfix
This commit is contained in:
parent
499f61f4ff
commit
a337e93ffe
@ -330,6 +330,7 @@ bricks.RTCP2PConnect = class {
|
|||||||
console.log(`${peer.id} state changed. new state=${pc.connectionState}`);
|
console.log(`${peer.id} state changed. new state=${pc.connectionState}`);
|
||||||
console.log('state=', pc.connectionState, typeof(pc.connectionState));
|
console.log('state=', pc.connectionState, typeof(pc.connectionState));
|
||||||
if (pc.connectionState == 'disconnected'){
|
if (pc.connectionState == 'disconnected'){
|
||||||
|
this.peer_close(peer);
|
||||||
if (this.opts.on_pc_disconnected){
|
if (this.opts.on_pc_disconnected){
|
||||||
this.opts.on_pc_disconnected(peer);
|
this.opts.on_pc_disconnected(peer);
|
||||||
}
|
}
|
||||||
@ -338,6 +339,9 @@ bricks.RTCP2PConnect = class {
|
|||||||
if (pc.connectionState == 'connected'){
|
if (pc.connectionState == 'connected'){
|
||||||
console.log('state is connected, data_connect=',
|
console.log('state is connected, data_connect=',
|
||||||
this.opts.data_connect);
|
this.opts.data_connect);
|
||||||
|
if(this.opts.on_pc_connected){
|
||||||
|
this.opts.on_pc_connected(peer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,9 +383,6 @@ bricks.RTCP2PConnect = class {
|
|||||||
this.peers[peer.id].dc = pc.createDataChannel('chat', {ordered:true});
|
this.peers[peer.id].dc = pc.createDataChannel('chat', {ordered:true});
|
||||||
var dc = this.peers[peer.id].dc;
|
var dc = this.peers[peer.id].dc;
|
||||||
await this.dc_created(peer, this.peers[peer.id].dc);
|
await this.dc_created(peer, this.peers[peer.id].dc);
|
||||||
if(this.opts.on_pc_connected){
|
|
||||||
this.opts.on_pc_connected(peer);
|
|
||||||
}
|
|
||||||
console.log('dc created', this.peers[peer.id].dc);
|
console.log('dc created', this.peers[peer.id].dc);
|
||||||
}
|
}
|
||||||
async createPeerConnection(peer){
|
async createPeerConnection(peer){
|
||||||
@ -460,6 +461,12 @@ bricks.RTCP2PConnect = class {
|
|||||||
}
|
}
|
||||||
pc.close();
|
pc.close();
|
||||||
delete self.peers[peer.id];
|
delete self.peers[peer.id];
|
||||||
|
var keys = Object.keys(self.peers);
|
||||||
|
if (keys.length == 0){
|
||||||
|
this.localVideo.srcObject.getTracks().forEach(track => track.stop());
|
||||||
|
this.local_stream.getTracks().forEach(track => track.stop());
|
||||||
|
this.local_screan.getTracks().forEach(track => track.stop());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user