Add the kind of producer on new-producer event

This commit is contained in:
Sergiu Toma 2023-02-11 21:13:57 +02:00
parent 50e95b93a4
commit 6b822142d0

3
app.js
View File

@ -260,7 +260,6 @@ peers.on('connection', async (socket) => {
isInitiator(callId, socket.id) isInitiator(callId, socket.id)
? await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters }) ? await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters })
: await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters }); : await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters });
} catch (error) { } catch (error) {
console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
} }
@ -370,8 +369,8 @@ peers.on('connection', async (socket) => {
const socketToEmit = isInitiator(callId, socket.id) const socketToEmit = isInitiator(callId, socket.id)
? videoCalls[callId].receiverSocket ? videoCalls[callId].receiverSocket
: videoCalls[callId].initiatorSocket; : videoCalls[callId].initiatorSocket;
socketToEmit.emit('new-producer', { callId });
socketToEmit.emit('new-producer', { callId, kind });
} catch (error) { } catch (error) {
console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);
} }