This commit is contained in:
yumoqing 2024-10-11 12:58:08 +08:00
parent 0865cc3b6d
commit 1761a48851

View File

@ -186,7 +186,7 @@ bricks.RTCP2PConnect = class {
this.opts = opts;
this.peers = {};
this.signal_handlers = {};
this.localStream = null;
this.local_stream = null;
this.localVideo = null;
this.add_handler('sessioncreated', this.h_sessioncreated.bind(this));
this.add_handler('callrequest', this.h_callrequest.bind(this));
@ -356,10 +356,12 @@ bricks.RTCP2PConnect = class {
iceServers:this.opts.ice_servers
}
var pc = new RTCPeerConnection(configuration);
this.localStream.getTracks()
.forEach(track => {
pc.addTrack(track, this.localStream);
});
if (this.local_stream){
this.local_stream.getTracks()
.forEach(track => {
pc.addTrack(track, this.local_stream);
});
}
this.peers[peer.id] = peer;
this.peers[peer.id][pc] = pc;
var remoteVideo = new VideoBox();