bugfix
This commit is contained in:
parent
89c7b2592f
commit
33ef5372e7
@ -241,6 +241,7 @@ bricks.RTCP2PConnect = class {
|
||||
}
|
||||
}
|
||||
async h_callaccepted(data){
|
||||
this.createDataChannel(data.msgfrom);
|
||||
await this.send_offer(data.msgfrom, true);
|
||||
}
|
||||
async h_offer(data){
|
||||
@ -374,6 +375,15 @@ bricks.RTCP2PConnect = class {
|
||||
await this.opts.on_dc_close(dc);
|
||||
}
|
||||
}
|
||||
createDataChannel(peer){
|
||||
this.peers[peer.id].dc = pc.createDataChannel('chat', {ordered:true});
|
||||
var dc = 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);
|
||||
}
|
||||
async createPeerConnection(peer){
|
||||
const configuration = {
|
||||
iceServers:this.opts.ice_servers
|
||||
@ -391,15 +401,6 @@ bricks.RTCP2PConnect = class {
|
||||
this.peers[peer.id].role = '';
|
||||
var remoteVideo = new bricks.VideoBox();
|
||||
this.peers[peer.id].video = remoteVideo;
|
||||
if (role == 'requester'){
|
||||
this.peers[peer.id].dc = pc.createDataChannel('chat', {ordered:true});
|
||||
var dc = 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);
|
||||
}
|
||||
pc.onicecandidate = this.send_candidate.bind(this, peer);
|
||||
pc.oniceconnectionstatechange = this.ice_statechange.bind(this, peer);
|
||||
pc.onconnectionstatechange = this.connection_statechange.bind(this, peer);
|
||||
|
Loading…
Reference in New Issue
Block a user