Delete the whole call(with id) when we call closeCall #5
2
.env
2
.env
@ -1,3 +1,3 @@
|
|||||||
PORT=3000
|
PORT=3001
|
||||||
IP=0.0.0.0 # Listening IPv4 or IPv6.
|
IP=0.0.0.0 # Listening IPv4 or IPv6.
|
||||||
ANNOUNCED_IP=185.8.154.190 # Announced IPv4 or IPv6 (useful when running mediasoup behind NAT with private IP).
|
ANNOUNCED_IP=185.8.154.190 # Announced IPv4 or IPv6 (useful when running mediasoup behind NAT with private IP).
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# Video server
|
# Video server
|
||||||
|
|
||||||
|
### Generating certificates
|
||||||
|
|
||||||
|
##### To generate SSL certificates you must:
|
||||||
|
1. Go to `/server/ssl`
|
||||||
|
2. Execute `openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem`
|
||||||
|
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
|
18
app.js
18
app.js
@ -110,7 +110,7 @@ const closeCall = (callId) => {
|
|||||||
videoCalls[callId]?.consumerTransport.close();
|
videoCalls[callId]?.consumerTransport.close();
|
||||||
videoCalls[callId]?.producerTransport.close();
|
videoCalls[callId]?.producerTransport.close();
|
||||||
videoCalls[callId].router.close();
|
videoCalls[callId].router.close();
|
||||||
delete videoCalls[callId].router;
|
delete videoCalls[callId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,22 +209,18 @@ peers.on('connection', async socket => {
|
|||||||
paused: true,
|
paused: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// https://mediasoup.org/documentation/v3/mediasoup/api/#consumer-on-transportclose
|
||||||
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();
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#router-close
|
|
||||||
videoCalls[callId].producer.close()
|
|
||||||
videoCalls[callId].consumer.close()
|
|
||||||
delete videoCalls[callId].router
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 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();
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#router-close
|
|
||||||
closeCall()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// from the consumer extract the following params
|
// from the consumer extract the following params
|
||||||
|
Loading…
Reference in New Issue
Block a user