diff --git a/app.js b/app.js index a06f4a9..b37597d 100644 --- a/app.js +++ b/app.js @@ -451,13 +451,13 @@ peers.on('connection', async socket => { if (isInitiator(callId, socket.id)) { console.log('🟩'); console.log(`[consumer-resume] isInitiator true`); - await videoCalls[callId].initiatorConsumerVideo.resume(); - await videoCalls[callId].initiatorConsumerAudio.resume(); + await videoCalls[callId]?.initiatorConsumerVideo?.resume(); + await videoCalls[callId]?.initiatorConsumerAudio?.resume(); } else { console.log('🟥'); console.log(`[consumer-resume] isInitiator false`); - (videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerVideo.resume(); - (videoCalls[callId].receiverConsumerVideo) && await videoCalls[callId].receiverConsumerAudio.resume(); + await videoCalls[callId]?.receiverConsumerVideo?.resume(); + await videoCalls[callId]?.receiverConsumerAudio?.resume(); } } catch (error) { console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);