From f5d45ce3a3af71b45523bef61889dd115d70f86b Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 21 Feb 2023 00:18:00 +0200 Subject: [PATCH] LH-276: Update producer close event handler --- app.js | 8 ++++++++ public/bundle.js | 26 ++++++++++++++++++++++++++ public/index.js | 26 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/app.js b/app.js index 34fcc51..0e38012 100644 --- a/app.js +++ b/app.js @@ -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', () => { diff --git a/public/bundle.js b/public/bundle.js index 57ef38c..6208ae5 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -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 } diff --git a/public/index.js b/public/index.js index ed66dc8..ba76d61 100644 --- a/public/index.js +++ b/public/index.js @@ -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 }