This commit is contained in:
Sergiu Toma 2023-01-13 19:09:20 +02:00
parent 5b9768b5de
commit 3c5719c3c8

4
app.js
View File

@ -233,8 +233,10 @@ peers.on('connection', async socket => {
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
if (sender) {
if(!videoCalls[callId].receiverProducerTransport && !isInitiator(callId, socket.id)) {
console.log('1');
videoCalls[callId].receiverProducerTransport = await createWebRtcTransportLayer(callId, callback);
} else if(!videoCalls[callId].initiatorProducerTransport && isInitiator(callId, socket.id)) {
console.log('1');
videoCalls[callId].initiatorProducerTransport = await createWebRtcTransportLayer(callId, callback);
} else {
console.log(`producerTransport has already been defined | callId ${callId}`);
@ -242,8 +244,10 @@ peers.on('connection', async socket => {
}
} else if (!sender) {
if(!videoCalls[callId].receiverConsumerTransport && !isInitiator(callId, socket.id)) {
console.log('3');
videoCalls[callId].receiverConsumerTransport = await createWebRtcTransportLayer(callId, callback);
} else if(!videoCalls[callId].initiatorConsumerTransport && isInitiator(callId, socket.id)) {
console.log('4');
videoCalls[callId].initiatorConsumerTransport = await createWebRtcTransportLayer(callId, callback);
}
}