From 2098fbdd891363eefddac36132ebe651541e41eb Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 21 Feb 2023 01:12:32 +0200 Subject: [PATCH] LH-276: Update producer close event handler --- app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app.js b/app.js index 1566edc..5b9cb9e 100644 --- a/app.js +++ b/app.js @@ -388,7 +388,7 @@ peers.on('connection', async (socket) => { // callId - Id of the call // kind - producer type: audio/video - socketToEmit.emit('new-producer', { callId, kind }); + socketToEmit?.emit('new-producer', { callId, kind }); } catch (error) { console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`); } @@ -510,11 +510,9 @@ peers.on('connection', async (socket) => { const callId = socketDetails[socket.id]; console.log(`[close-producer] callId: ${callId} | kind: kind`); if (isInitiator(callId, socket.id)) { - console.log(`[close-producer] initiator`); if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close() else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close() } else { - console.log(`[close-producer] receiver`); if (kind === 'video') videoCalls[callId].receiverVideoProducer.close() else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close() }