LH-276: Update producer close event handler

This commit is contained in:
Sergiu Toma 2023-02-21 01:55:40 +02:00
parent c65dcf1729
commit 7ec9f4ebde

56
app.js
View File

@ -487,32 +487,36 @@ peers.on('connection', async (socket) => {
- When consuming on consumerTransport, it is initially done with paused: true, here we will resume - When consuming on consumerTransport, it is initially done with paused: true, here we will resume
- For the initiator we resume the initiatorConsumerAUDIO/VIDEO and for receiver the receiverConsumerAUDIO/VIDEO - For the initiator we resume the initiatorConsumerAUDIO/VIDEO and for receiver the receiverConsumerAUDIO/VIDEO
*/ */
socket.on('consumer-resume', () => { try {
try { socket.on('consumer-resume', () => {
const callId = socketDetails[socket.id]; try {
const isInitiatorValue = isInitiator(callId, socket.id); const callId = socketDetails[socket.id];
console.log(`[consumer-resume] callId: ${callId} | isInitiator: ${isInitiatorValue}`); const isInitiatorValue = isInitiator(callId, socket.id);
if (isInitiatorValue) { console.log(`[consumer-resume] callId: ${callId} | isInitiator: ${isInitiatorValue}`);
try { if (isInitiatorValue) {
videoCalls[callId].initiatorConsumerVideo && videoCalls[callId].initiatorConsumerVideo.resume(); try {
videoCalls[callId].initiatorConsumerAudio && videoCalls[callId].initiatorConsumerAudio.resume(); videoCalls[callId].initiatorConsumerVideo && videoCalls[callId].initiatorConsumerVideo.resume();
} catch (error) { videoCalls[callId].initiatorConsumerAudio && videoCalls[callId].initiatorConsumerAudio.resume();
console.log('sssss', error.message); } catch (error) {
} console.log('sssss', error.message);
} else { }
try { } else {
// videoCalls[callId].receiverConsumerVideo && videoCalls[callId].receiverConsumerVideo.resume(); try {
// videoCalls[callId].receiverConsumerAudio && videoCalls[callId].receiverConsumerAudio.resume(); // videoCalls[callId].receiverConsumerVideo && videoCalls[callId].receiverConsumerVideo.resume();
} catch (error) { // videoCalls[callId].receiverConsumerAudio && videoCalls[callId].receiverConsumerAudio.resume();
console.log('sssss22222', error.message); } catch (error) {
} console.log('sssss22222', error.message);
console.log('videoCalls[callId].receiverConsumerVideo', videoCalls[callId].receiverConsumerVideo); }
console.log('videoCalls[callId].receiverConsumerAudio', videoCalls[callId].receiverConsumerAudio); console.log('videoCalls[callId].receiverConsumerVideo', videoCalls[callId].receiverConsumerVideo);
} console.log('videoCalls[callId].receiverConsumerAudio', videoCalls[callId].receiverConsumerAudio);
} catch (error) { }
console.error(`[consumer-resume] | ERROR | callId: ${socketDetails[socket.id]} | isInitiator: ${isInitiator} | error: ${error.message}`); } catch (error) {
} console.error(`[consumer-resume] | ERROR | callId: ${socketDetails[socket.id]} | isInitiator: ${isInitiator} | error: ${error.message}`);
}); }
});
} catch (error) {
console.log('akakakakakak', error.mesage);
}
socket.on('close-producer', ({ callId, kind}) => { socket.on('close-producer', ({ callId, kind}) => {
try { try {