diff --git a/app.js b/app.js index 4a29f56..a7f7381 100644 --- a/app.js +++ b/app.js @@ -227,6 +227,17 @@ peers.on('connection', async (socket) => { videoCalls[callId].receiverProducerTransport = await createWebRtcTransportLayer(callId, callback); } else if (!videoCalls[callId].initiatorProducerTransport && isInitiator(callId, socket.id)) { videoCalls[callId].initiatorProducerTransport = await createWebRtcTransportLayer(callId, callback); + + videoCalls[callId].initiatorProducerTransport.observer.on("newproducer", (producer) => + { + console.log( + "------------------new producer created [worker.pid:%d, router.id:%s, transport.id:%s, producer.id:%s]", producer.id); + + producer.observer.on("close", () => { + console.log("-------------------producer closed [producer.id:%s]", producer.id); + }); + }); + } else { console.log(`producerTransport has already been defined | callId ${callId}`); callback(null); @@ -320,23 +331,22 @@ peers.on('connection', async (socket) => { console.log('🟢'); videoCalls[callId].initiatorVideoProducer.on('close', () => { - console.log('1 initiatorVideoProducer for this producer closed', callId); + console.log('===================1 initiatorVideoProducer for this producer closed', callId); }); videoCalls[callId].initiatorVideoProducer.observer.on("close", () => { - console.log('2 initiatorVideoProducer for this producer closed', callId); + console.log('====================2 initiatorVideoProducer for this producer closed', callId); }) - videoCalls[callId].initiatorProducerTransport.observer.on("newproducer", (producer) => - { - console.log( - "new producer created [worker.pid:%d, router.id:%s, transport.id:%s, producer.id:%s]", producer.id); + // videoCalls[callId].initiatorProducerTransport.observer.on("newproducer", (producer) => + // { + // console.log( + // "new producer created [worker.pid:%d, router.id:%s, transport.id:%s, producer.id:%s]", producer.id); - producer.observer.on("close", () => - { - console.log("producer closed [producer.id:%s]", producer.id); - }); - }); + // producer.observer.on("close", () => { + // console.log("producer closed [producer.id:%s]", producer.id); + // }); + // }); callback && callback({