diff --git a/app.js b/app.js index 5b9cb9e..b9945f6 100644 --- a/app.js +++ b/app.js @@ -492,8 +492,11 @@ peers.on('connection', async (socket) => { socket.on('consumer-resume', () => { try { const callId = socketDetails[socket.id]; - console.log(`[consumer-resume] callId: ${callId}`); - if (isInitiator(callId, socket.id)) { + const isInitiator = isInitiator(callId, socket.id); + console.log(`[consumer-resume] callId: ${callId} | isInitiator: ${isInitiator}`); + console.log('videoCalls[callId]?.receiverConsumerVideo?', videoCalls[callId]?.receiverConsumerVideo); + console.log('videoCalls[callId]?.receiverConsumerAudio', videoCalls[callId]?.receiverConsumerAudio); + if (isInitiator) { videoCalls[callId]?.initiatorConsumerVideo?.resume(); videoCalls[callId]?.initiatorConsumerAudio?.resume(); } else { @@ -501,14 +504,13 @@ peers.on('connection', async (socket) => { videoCalls[callId]?.receiverConsumerAudio?.resume(); } } catch (error) { - console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`); + console.error(`[consumer-resume] | ERROR | callId: ${callId} | isInitiator: ${isInitiator} | error: ${error.message}`); } }); socket.on('close-producer', ({ callId, kind}) => { try { - const callId = socketDetails[socket.id]; - console.log(`[close-producer] callId: ${callId} | kind: kind`); + console.log(`[close-producer] callId: ${callId} | kind: ${kind}`); if (isInitiator(callId, socket.id)) { if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close() else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()