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