LH-276: Update producer close enent handler

This commit is contained in:
Sergiu Toma 2023-02-20 23:28:19 +02:00
parent 12ad433c9f
commit d91fcfd584

16
app.js
View File

@ -429,15 +429,8 @@ peers.on('connection', async (socket) => {
// await videoCalls[callId].consumerTransport.connect({ dtlsParameters }); // await videoCalls[callId].consumerTransport.connect({ dtlsParameters });
if (!isInitiator(callId, socket.id)) { if (!isInitiator(callId, socket.id)) {
await videoCalls[callId].receiverConsumerTransport.connect({ dtlsParameters }); await videoCalls[callId].receiverConsumerTransport.connect({ dtlsParameters });
videoCalls[callId].receiverConsumerTransport.on('producerclose', () => {
console.log('🟦----------------producerclose receiverConsumerTransport');
});
} else if (isInitiator(callId, socket.id)) { } else if (isInitiator(callId, socket.id)) {
await videoCalls[callId].initiatorConsumerTransport.connect({ dtlsParameters }); await videoCalls[callId].initiatorConsumerTransport.connect({ dtlsParameters });
console.log('🟦----------------')
videoCalls[callId].initiatorConsumerTransport.on('producerclose', () => {
console.log('🟦----------------producerclose initiatorConsumerTransport');
});
} }
} catch (error) { } catch (error) {
console.log(`ERROR | transport-recv-connect | callId ${socketDetails[socket.id]} | ${error.message}`); console.log(`ERROR | transport-recv-connect | callId ${socketDetails[socket.id]} | ${error.message}`);
@ -546,16 +539,17 @@ const consumeVideo = async (callId, socketId, rtpCapabilities) => {
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
videoCalls[callId].initiatorConsumerVideo.on('transportclose', () => { videoCalls[callId].initiatorConsumerVideo.on('transportclose', () => {
const callId = socketDetails[socket.id];
console.log('transport close from consumer', callId); console.log('transport close from consumer', callId);
closeCall(callId); closeCall(callId);
}); });
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose
videoCalls[callId].initiatorConsumerVideo.on('producerclose', () => { videoCalls[callId].initiatorConsumerVideo.on('producerclose', () => {
const callId = socketDetails[socket.id]; console.log('000000000000000000000000000 producer of consumer closed', callId);
console.log('producer of consumer closed', callId); });
closeCall(callId);
videoCalls[callId].initiatorConsumerTransport.on('producerclose', () => {
console.log('000000000000000000000000000 producerclose initiatorConsumerTransport');
}); });
return { return {