diff --git a/app.js b/app.js index d4370ad..2f1791e 100644 --- a/app.js +++ b/app.js @@ -448,11 +448,19 @@ peers.on('connection', async socket => { try { const callId = socketDetails[socket.id]; if (isInitiator(callId, socket.id)) { - initiatorConsumerVideo && videoCalls[callId].initiatorConsumerVideo?.resume(); - initiatorConsumerAudio && videoCalls[callId].initiatorConsumerAudio?.resume(); + if (videoCalls[callId]?.initiatorConsumerVideo){ + videoCalls[callId].initiatorConsumerVideo?.resume(); + } + if (videoCalls[callId]?.initiatorConsumerAudio){ + videoCalls[callId].initiatorConsumerAudio?.resume(); + } } else { - receiverConsumerVideo && videoCalls[callId].receiverConsumerVideo?.resume(); - receiverConsumerAudio && videoCalls[callId].receiverConsumerAudio?.resume(); + if (videoCalls[callId]?.receiverConsumerVideo) { + videoCalls[callId].receiverConsumerVideo?.resume(); + } + if (videoCalls[callId]?.receiverConsumerAudio) { + videoCalls[callId].receiverConsumerAudio?.resume(); + } } } catch (error) { console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);