LH-253: Added callId for transportclose and producerclose events #12

Merged
sergiu merged 2 commits from LH-253-mediasoup-handle-callid-undefined into master 2022-10-18 07:53:33 +00:00
Showing only changes of commit fafbee6e4c - Show all commits

4
app.js
View File

@ -299,14 +299,14 @@ peers.on('connection', async socket => {
videoCalls[callId].consumer.on('transportclose', () => { videoCalls[callId].consumer.on('transportclose', () => {
const callId = socketDetails[socket.id]; const callId = socketDetails[socket.id];
console.log('transport close from consumer', callId); console.log('transport close from consumer', callId);
closeCall(); closeCall(callId);
Review

We should test callId to be a valid value before using it in closeCall.

We should test `callId` to be a valid value before using it in `closeCall`.
}); });
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose
videoCalls[callId].consumer.on('producerclose', () => { videoCalls[callId].consumer.on('producerclose', () => {
const callId = socketDetails[socket.id]; const callId = socketDetails[socket.id];
console.log('producer of consumer closed', callId); console.log('producer of consumer closed', callId);
closeCall(); closeCall(callId);
}); });
// From the consumer extract the following params to send back to the Client // From the consumer extract the following params to send back to the Client