Refactor consumer-resume v3

This commit is contained in:
Sergiu Toma 2023-01-12 12:46:46 +02:00
parent 1342e812e6
commit e6c08a2c1d

16
app.js
View File

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