From 1dcc9321ba4a68e355b32230525b379cce3b611a Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 21 Feb 2023 01:32:50 +0200 Subject: [PATCH] LH-276: Update producer close event handler --- app.js | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/app.js b/app.js index 373054d..4e207f4 100644 --- a/app.js +++ b/app.js @@ -524,6 +524,7 @@ peers.on('connection', async (socket) => { }); const consumeVideo = async (callId, socketId, rtpCapabilities) => { + // Handlers for transports https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose if (isInitiator(callId, socketId)) { videoCalls[callId].initiatorConsumerVideo = await videoCalls[callId].initiatorConsumerTransport.consume({ producerId: videoCalls[callId].receiverVideoProducer.id, @@ -531,12 +532,6 @@ const consumeVideo = async (callId, socketId, rtpCapabilities) => { paused: true, }); - // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose - videoCalls[callId].initiatorConsumerVideo.on('transportclose', () => { - console.log('transport close from consumer', callId); - closeCall(callId); - }); - return { id: videoCalls[callId].initiatorConsumerVideo.id, producerId: videoCalls[callId].receiverVideoProducer.id, @@ -550,12 +545,6 @@ const consumeVideo = async (callId, socketId, rtpCapabilities) => { paused: true, }); - videoCalls[callId].receiverConsumerVideo.on('transportclose', () => { - const callId = socketDetails[socket.id]; - console.log('transport close from consumer', callId); - closeCall(callId); - }); - return { id: videoCalls[callId].receiverConsumerVideo.id, producerId: videoCalls[callId].initiatorVideoProducer.id, @@ -573,20 +562,6 @@ const consumeAudio = async (callId, socketId, rtpCapabilities) => { paused: true, }); - // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose - videoCalls[callId].initiatorConsumerAudio.on('transportclose', () => { - const callId = socketDetails[socket.id]; - console.log('transport close from consumer', callId); - closeCall(callId); - }); - - // https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-producerclose - videoCalls[callId].initiatorConsumerAudio.on('producerclose', () => { - const callId = socketDetails[socket.id]; - console.log('producer of consumer closed', callId); - closeCall(callId); - }); - return { id: videoCalls[callId].initiatorConsumerAudio.id, producerId: videoCalls[callId].receiverAudioProducer.id, @@ -600,18 +575,6 @@ const consumeAudio = async (callId, socketId, rtpCapabilities) => { paused: true, }); - videoCalls[callId].receiverConsumerAudio.on('transportclose', () => { - const callId = socketDetails[socket.id]; - console.log('transport close from consumer', callId); - closeCall(callId); - }); - - videoCalls[callId].receiverConsumerAudio.on('producerclose', () => { - const callId = socketDetails[socket.id]; - console.log('producer of consumer closed', callId); - closeCall(callId); - }); - return { id: videoCalls[callId].receiverConsumerAudio.id, producerId: videoCalls[callId].initiatorAudioProducer.id,