Merge pull request 'Moved 'new-producer' in 'transport-produce' handler' (#25) from new-producer-in-transport-produce into develop

Reviewed-on: #25
Reviewed-by: Cristi Ene <cristi.ene@safemobile.com>
This commit is contained in:
Sergiu Toma 2023-01-19 06:54:53 +00:00
commit 09e82fb224

11
app.js
View File

@ -261,11 +261,6 @@ peers.on('connection', async (socket) => {
? await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters }) ? await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters })
: await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters }); : await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters });
const socketToEmit = isInitiator(callId, socket.id)
? videoCalls[callId].receiverSocket
: videoCalls[callId].initiatorSocket;
socketToEmit.emit('new-producer', { callId });
} catch (error) { } catch (error) {
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
} }
@ -371,6 +366,12 @@ peers.on('connection', async (socket) => {
}); });
} }
} }
const socketToEmit = isInitiator(callId, socket.id)
? videoCalls[callId].receiverSocket
: videoCalls[callId].initiatorSocket;
socketToEmit.emit('new-producer', { callId });
} catch (error) { } catch (error) {
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
} }