LH-276: Update producer close event handler
This commit is contained in:
parent
59f8d4d360
commit
1dcc9321ba
39
app.js
39
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,
|
||||
|
Loading…
Reference in New Issue
Block a user