LH-276: Format code

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

72
app.js
View File

@ -498,39 +498,45 @@ const consumeVideo = async ({ callId, socketId, rtpCapabilities }) => {
}; };
const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => { const consumeAudio = async ({ callId, socketId, rtpCapabilities }) => {
// Handlers for consumer transport https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose try {
if (isInitiator(callId, socketId)) { // Handlers for consumer transport https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
const producerId = videoCalls[callId].receiverAudioProducer.id; if (isInitiator(callId, socketId)) {
if (!canConsume({ callId, producerId, rtpCapabilities })) return null; const producerId = videoCalls[callId].receiverAudioProducer.id;
if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
videoCalls[callId].initiatorConsumerAudio = await videoCalls[callId].initiatorConsumerTransport.consume({
producerId, videoCalls[callId].initiatorConsumerAudio = await videoCalls[callId].initiatorConsumerTransport.consume({
rtpCapabilities, producerId,
paused: true, rtpCapabilities,
}); paused: true,
});
return { const returnData = {
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,
}; };
} else { console.log('audio returnData', returnData);
const producerId = videoCalls[callId].initiatorAudioProducer.id; return returnData;
if (!canConsume({ callId, producerId, rtpCapabilities })) return null; } else {
const producerId = videoCalls[callId].initiatorAudioProducer.id;
videoCalls[callId].receiverConsumerAudio = await videoCalls[callId].receiverConsumerTransport.consume({ if (!canConsume({ callId, producerId, rtpCapabilities })) return null;
producerId,
rtpCapabilities, videoCalls[callId].receiverConsumerAudio = await videoCalls[callId].receiverConsumerTransport.consume({
paused: true, producerId,
}); rtpCapabilities,
paused: true,
return { });
id: videoCalls[callId].receiverConsumerAudio.id, const returnData = {
producerId, id: videoCalls[callId].receiverConsumerAudio.id,
kind: 'audio', producerId,
rtpParameters: videoCalls[callId].receiverConsumerAudio.rtpParameters, kind: 'audio',
}; rtpParameters: videoCalls[callId].receiverConsumerAudio.rtpParameters,
};
console.log('audio returnData', returnData);
return returnData;
}
} catch (error) {
console.error(`[consumeAudio] | ERROR | error: ${error.message}`)
} }
}; };