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