Check for initiatorConsumerAudio before resume()

This commit is contained in:
Sergiu Toma 2023-01-12 12:38:40 +02:00
parent c034610471
commit 5bf31d452f

8
app.js
View File

@ -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}`);