diff --git a/app.js b/app.js index 05b9894..3d21d27 100644 --- a/app.js +++ b/app.js @@ -156,9 +156,10 @@ peers.on('connection', async socket => { console.log(`[transport-produce] Producer ID: ${producer.id} | kind: ${producer.kind}`) - producer.on('transportclose', () => { + producer.on('transportclose', ({ callId }) => { console.log('transport for this producer closed ') producer.close() + router[callId] = null }) // Send back to the client the Producer's id diff --git a/public/index.js b/public/index.js index c30f4d1..10cf6bd 100644 --- a/public/index.js +++ b/public/index.js @@ -56,7 +56,8 @@ if (IS_PRODUCER === true) { } if (parsedData.type === 'notify-end') { - remoteVideo.srcObject = null; + localVideo.srcObject = null + remoteVideo.srcObject = null console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); // socket.emit('transportclose') socket.emit('transportclose') @@ -271,7 +272,7 @@ const connectSendTransport = async () => { // close video track }) - producer.on('transportclose', () => { + producer.on('transportclose', { callId },() => { console.log('transport ended') // close video track })