LH-276: Update producer close event handler

This commit is contained in:
Sergiu Toma 2023-02-21 02:00:02 +02:00
parent bc07a055e0
commit 7e3e40e5e1

14
app.js
View File

@ -521,13 +521,13 @@ peers.on('connection', async (socket) => {
socket.on('close-producer', ({ callId, kind}) => { socket.on('close-producer', ({ callId, kind}) => {
try { try {
console.log(`[close-producer] callId: ${callId} | kind: ${kind}`); console.log(`[close-producer] callId: ${callId} | kind: ${kind}`);
if (isInitiator(callId, socket.id)) { // if (isInitiator(callId, socket.id)) {
if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close() // if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close()
else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close() // else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()
} else { // } else {
if (kind === 'video') videoCalls[callId].receiverVideoProducer.close() // if (kind === 'video') videoCalls[callId].receiverVideoProducer.close()
else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close() // else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close()
} // }
} catch (error) { } catch (error) {
console.error(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | error: ${error.message}`); console.error(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | error: ${error.message}`);
} }