LH-276: Update producer close event handler

This commit is contained in:
Sergiu Toma 2023-02-21 00:18:00 +02:00
parent 9560d33870
commit f5d45ce3a3
3 changed files with 60 additions and 0 deletions

8
app.js
View File

@ -335,6 +335,14 @@ peers.on('connection', async (socket) => {
});
videoCalls[callId].initiatorVideoProducer.observer.on("close", () => {
console.log('====================2 initiatorVideoProducer for this producer closed', callId);
// const socketToEmit = isInitiator(callId, socket.id)
// ? videoCalls[callId].receiverSocket
// : videoCalls[callId].initiatorSocket;
// // callId - Id of the call
// // kind - producer type: audio/video
// socketToEmit.emit('new-producer', { callId, kind });
receiverSocket.emit('close-producer', { callId, kind });
})
videoCalls[callId].initiatorVideoProducer.on('producerclose', () => {

View File

@ -20457,6 +20457,10 @@ setTimeout(() => {
console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`);
connectRecvTransport();
})
socket.on('close-producer', ({ callId, kind }) => {
console.log(`🔴 close-producer | callId: ${callId} | kind: ${kind}`);
})
}
if (IS_PRODUCER === true) {
@ -20857,6 +20861,28 @@ const getVideoTrask = async (videoParams) => {
consumerVideo.on("producerclose", () => {
console.log('====================2 consumerVideo producerclose');
})
consumerVideo.on("close", () => {
console.log('====================3 consumerVideo producerclose');
})
consumerVideo.on("close-producer", () => {
console.log('====================4 consumerVideo producerclose');
})
consumerVideo.observer.on('producerclose', () => {
console.log('===================11 consumerVideo producerclose');
});
consumerVideo.observer.on("producerclose", () => {
console.log('====================22 consumerVideo producerclose');
})
consumerVideo.observer.on("close", () => {
console.log('====================33 consumerVideo producerclose');
})
consumerVideo.observer.on("close-producer", () => {
console.log('====================44 consumerVideo producerclose');
})
return consumerVideo.track
}

View File

@ -99,6 +99,10 @@ setTimeout(() => {
console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`);
connectRecvTransport();
})
socket.on('close-producer', ({ callId, kind }) => {
console.log(`🔴 close-producer | callId: ${callId} | kind: ${kind}`);
})
}
if (IS_PRODUCER === true) {
@ -499,6 +503,28 @@ const getVideoTrask = async (videoParams) => {
consumerVideo.on("producerclose", () => {
console.log('====================2 consumerVideo producerclose');
})
consumerVideo.on("close", () => {
console.log('====================3 consumerVideo producerclose');
})
consumerVideo.on("close-producer", () => {
console.log('====================4 consumerVideo producerclose');
})
consumerVideo.observer.on('producerclose', () => {
console.log('===================11 consumerVideo producerclose');
});
consumerVideo.observer.on("producerclose", () => {
console.log('====================22 consumerVideo producerclose');
})
consumerVideo.observer.on("close", () => {
console.log('====================33 consumerVideo producerclose');
})
consumerVideo.observer.on("close-producer", () => {
console.log('====================44 consumerVideo producerclose');
})
return consumerVideo.track
}