LH-276: Format code

This commit is contained in:
Sergiu Toma 2023-02-22 18:36:50 +02:00
parent abb1533c9b
commit c80265fe25

14
app.js
View File

@ -498,6 +498,7 @@ const consumeVideo = async ({ callId, socketId, rtpCapabilities }) => {
}; };
const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => { const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
try {
// Handlers for consumer transport https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose // Handlers for consumer transport https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
if (isInitiator(callId, socketId)) { if (isInitiator(callId, socketId)) {
const producerId = videoCalls[callId].receiverAudioProducer.id; const producerId = videoCalls[callId].receiverAudioProducer.id;
@ -508,13 +509,14 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
rtpCapabilities, rtpCapabilities,
paused: true, paused: true,
}); });
const returnData = {
return {
id: videoCalls[callId].initiatorConsumerAudio.id, id: videoCalls[callId].initiatorConsumerAudio.id,
producerId, producerId,
kind: 'audio', kind: 'audio',
rtpParameters: videoCalls[callId].initiatorConsumerAudio.rtpParameters, rtpParameters: videoCalls[callId].initiatorConsumerAudio.rtpParameters,
}; };
console.log('audio returnData', returnData);
return returnData;
} else { } else {
const producerId = videoCalls[callId].initiatorAudioProducer.id; const producerId = videoCalls[callId].initiatorAudioProducer.id;
if (!canConsume({ callId, producerId, rtpCapabilities })) return null; if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
@ -524,13 +526,17 @@ const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
rtpCapabilities, rtpCapabilities,
paused: true, paused: true,
}); });
const returnData = {
return {
id: videoCalls[callId].receiverConsumerAudio.id, id: videoCalls[callId].receiverConsumerAudio.id,
producerId, producerId,
kind: 'audio', kind: 'audio',
rtpParameters: videoCalls[callId].receiverConsumerAudio.rtpParameters, rtpParameters: videoCalls[callId].receiverConsumerAudio.rtpParameters,
}; };
console.log('audio returnData', returnData);
return returnData;
}
} catch (error) {
console.error(`[consumeAudio] | ERROR | error: ${error.message}`)
} }
}; };