Close producer when dispatcher close the window
This commit is contained in:
parent
ea8d4268ec
commit
14d96fa7c5
3
app.js
3
app.js
@ -156,9 +156,10 @@ peers.on('connection', async socket => {
|
|||||||
|
|
||||||
console.log(`[transport-produce] Producer ID: ${producer.id} | kind: ${producer.kind}`)
|
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 ')
|
console.log('transport for this producer closed ')
|
||||||
producer.close()
|
producer.close()
|
||||||
|
router[callId] = null
|
||||||
})
|
})
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
|
@ -56,7 +56,8 @@ if (IS_PRODUCER === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parsedData.type === 'notify-end') {
|
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);
|
console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId);
|
||||||
// socket.emit('transportclose')
|
// socket.emit('transportclose')
|
||||||
socket.emit('transportclose')
|
socket.emit('transportclose')
|
||||||
@ -271,7 +272,7 @@ const connectSendTransport = async () => {
|
|||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
|
||||||
producer.on('transportclose', () => {
|
producer.on('transportclose', { callId },() => {
|
||||||
console.log('transport ended')
|
console.log('transport ended')
|
||||||
// close video track
|
// close video track
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user