From 6e3ce9fbb34076a6f42b66d23e8d3e1d302f09a3 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 22 Feb 2023 18:30:28 +0200 Subject: [PATCH] LH-276: Format code --- app.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index e3a2600..640c56a 100644 --- a/app.js +++ b/app.js @@ -389,19 +389,32 @@ peers.on('connection', async (socket) => { try { const callId = socketDetails[socket.id]; const socketId = socket.id; + let audioParams, videoParams; - console.log(`[consume] socket ${socket.id} | callId: ${callId}`); + console.log(`[consume] socket ${socketId} | callId: ${callId}`); if (typeof rtpCapabilities === 'string') rtpCapabilities = JSON.parse(rtpCapabilities); - - callback({ - videoParams: await consumeVideo({ callId, socketId, rtpCapabilities }), - audioParams: await consumeAudio({ callId, socketId, rtpCapabilities }), - }); } catch (error) { - console.error(`[consume] | ERROR | callId: ${socketDetails[socket.id]} | error: ${error.message}`); + console.error(`[consume] | ERROR | callId: ${callId} | error: ${error.message}`); callback({ params: { error } }); } + + try { + videoParams = await consumeVideo({ callId, socketId, rtpCapabilities }); + } catch (error) { + console.error(`[consume] | ERROR | videoParams | callId: ${callId} | error: ${error.message}`); + } + + try { + audioParams = await consumeAudio({ callId, socketId, rtpCapabilities }); + } catch (error) { + console.error(`[consume] | ERROR | audioParams | callId: ${callId} | error: ${error.message}`); + } + + callback({ + videoParams, + audioParams, + }); }); /*