LH-276: Update producer close enent handler

This commit is contained in:
Sergiu Toma 2023-02-20 19:55:39 +02:00
parent a1d172ee07
commit 21b4b6d04f

16
app.js
View File

@ -289,13 +289,11 @@ peers.on('connection', async (socket) => {
); );
videoCalls[callId].receiverVideoProducer.on('transportclose', () => { videoCalls[callId].receiverVideoProducer.on('transportclose', () => {
const callId = socketDetails[socket.id];
console.log('transport for this producer closed', callId); console.log('transport for this producer closed', callId);
closeCall(callId); closeCall(callId);
}); });
videoCalls[callId].receiverVideoProducer.on('close', () => { videoCalls[callId].receiverVideoProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('receiverVideoProducer for this producer closed', callId); console.log('receiverVideoProducer for this producer closed', callId);
}); });
@ -315,16 +313,20 @@ peers.on('connection', async (socket) => {
); );
videoCalls[callId].initiatorVideoProducer.on('transportclose', () => { videoCalls[callId].initiatorVideoProducer.on('transportclose', () => {
const callId = socketDetails[socket.id];
console.log('transport for this producer closed', callId); console.log('transport for this producer closed', callId);
closeCall(callId); closeCall(callId);
}); });
console.log('🟢');
videoCalls[callId].initiatorVideoProducer.on('close', () => { videoCalls[callId].initiatorVideoProducer.on('close', () => {
const callId = socketDetails[socket.id]; console.log('1 initiatorVideoProducer for this producer closed', callId);
console.log('initiatorVideoProducer for this producer closed', callId);
}); });
videoCalls[callId].initiatorVideoProducer.observer.on("close", () => {
console.log('2 initiatorVideoProducer for this producer closed', callId);
})
callback && callback &&
callback({ callback({
id: videoCalls[callId].initiatorVideoProducer.id, id: videoCalls[callId].initiatorVideoProducer.id,
@ -342,13 +344,11 @@ peers.on('connection', async (socket) => {
); );
videoCalls[callId].receiverAudioProducer.on('transportclose', () => { videoCalls[callId].receiverAudioProducer.on('transportclose', () => {
const callId = socketDetails[socket.id];
console.log('transport for this producer closed', callId); console.log('transport for this producer closed', callId);
closeCall(callId); closeCall(callId);
}); });
videoCalls[callId].receiverAudioProducer.on('close', () => { videoCalls[callId].receiverAudioProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('receiverAudioProducer for this producer closed', callId); console.log('receiverAudioProducer for this producer closed', callId);
}); });
@ -368,13 +368,11 @@ peers.on('connection', async (socket) => {
); );
videoCalls[callId].initiatorAudioProducer.on('transportclose', () => { videoCalls[callId].initiatorAudioProducer.on('transportclose', () => {
const callId = socketDetails[socket.id];
console.log('transport for this producer closed', callId); console.log('transport for this producer closed', callId);
closeCall(callId); closeCall(callId);
}); });
videoCalls[callId].initiatorAudioProducer.on('close', () => { videoCalls[callId].initiatorAudioProducer.on('close', () => {
const callId = socketDetails[socket.id];
console.log('initiatorAudioProducer for this producer closed', callId); console.log('initiatorAudioProducer for this producer closed', callId);
}); });