LH-276: Add handlers for producer close

This commit is contained in:
Sergiu Toma 2023-02-20 19:42:47 +02:00
parent 0ddb43b4b5
commit 0c917d6477

20
app.js
View File

@ -294,6 +294,11 @@ peers.on('connection', async (socket) => {
closeCall(callId);
});
videoCalls[callId].receiverVideoProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('receiverVideoProducer for this producer closed', callId);
});
// Send back to the client the Producer's id
callback &&
callback({
@ -315,6 +320,11 @@ peers.on('connection', async (socket) => {
closeCall(callId);
});
videoCalls[callId].initiatorVideoProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('initiatorVideoProducer for this producer closed', callId);
});
callback &&
callback({
id: videoCalls[callId].initiatorVideoProducer.id,
@ -337,6 +347,11 @@ peers.on('connection', async (socket) => {
closeCall(callId);
});
videoCalls[callId].receiverAudioProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('receiverAudioProducer for this producer closed', callId);
});
// Send back to the client the Producer's id
callback &&
callback({
@ -358,6 +373,11 @@ peers.on('connection', async (socket) => {
closeCall(callId);
});
videoCalls[callId].initiatorAudioProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('initiatorAudioProducer for this producer closed', callId);
});
// Send back to the client the Producer's id
callback &&
callback({