LINXD-2209: Check for router in videoCalls

This commit is contained in:
Sergiu Toma 2022-09-15 09:32:41 +03:00
parent 41b50d2a11
commit f629012712

2
app.js
View File

@ -118,7 +118,7 @@ peers.on('connection', async socket => {
}) })
socket.on('createRoom', async ({ callId }, callback) => { socket.on('createRoom', async ({ callId }, callback) => {
if (videoCalls[callId].router === undefined) { if (videoCalls[callId]?.router === undefined) {
console.log('[createRoom] callId', callId); console.log('[createRoom] callId', callId);
videoCalls[callId].router = await worker.createRouter({ mediaCodecs }); videoCalls[callId].router = await worker.createRouter({ mediaCodecs });
console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`) console.log(`[createRoom] Router ID: ${videoCalls[callId].router.id}`)