This commit is contained in:
yumoqing 2024-10-11 13:22:52 +08:00
parent 58be2217eb
commit 1b4d371ce8

View File

@ -261,6 +261,7 @@ bricks.RTCP2PConnect = class {
pc.close(); pc.close();
} }
async send_offer(peer){ async send_offer(peer){
console.log('send_offer(), peers=', this.peers, 'peer=', peer);
pc = this.peers[peer.id].pc; pc = this.peers[peer.id].pc;
var offer = await pc.createOffer(); var offer = await pc.createOffer();
await pc.setLocalDescription(offer); await pc.setLocalDescription(offer);
@ -362,7 +363,7 @@ bricks.RTCP2PConnect = class {
pc.addTrack(track, this.local_stream); pc.addTrack(track, this.local_stream);
}); });
} }
this.peers[peer.id] = peer; this.peers[peer.id] = bricks.extend({}, peer);
this.peers[peer.id].pc = pc; this.peers[peer.id].pc = pc;
var remoteVideo = new bricks.VideoBox(); var remoteVideo = new bricks.VideoBox();
this.peers[peer.id].video = remoteVideo; this.peers[peer.id].video = remoteVideo;