This commit is contained in:
yumoqing 2024-10-11 16:02:02 +08:00
parent 595e2c126f
commit 1aae99c212

View File

@ -344,6 +344,10 @@ bricks.RTCP2PConnect = class {
}
}
async dc_accepted(peer, event){
dc = event.channel;
await this.dc_created(peer, event);
}
async dc_created(peer, dc){
console.log('dc_created.....');
this.peers[peer.id].dc = dc;
@ -393,10 +397,7 @@ bricks.RTCP2PConnect = class {
pc.onicecandidate = this.send_candidate.bind(this, peer);
pc.oniceconnectionstatechange = this.ice_statechange.bind(this, peer);
pc.onconnectionstatechange = this.connection_statechange.bind(this, peer);
pc.ondatachanel = event => {
var dc = event.channel;
await this.dc_created(peer, dc);
}
pc.ondatachanel = this.dc_accepted.bind(this, peer);
pc.ontrack = event => {
remoteVideo.set_stream(event.streams[0]);
}