Refactor transportclose 17
This commit is contained in:
parent
3473c10608
commit
7a564d4a61
24
app.js
24
app.js
@ -159,8 +159,11 @@ peers.on('connection', async socket => {
|
||||
|
||||
producer.on('transportclose', () => {
|
||||
console.log('transport for this producer closed', callId)
|
||||
// closeRoom(callId)
|
||||
|
||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#producer-close
|
||||
producer.close()
|
||||
|
||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#router-close
|
||||
router[callId].close()
|
||||
delete router[callId]
|
||||
})
|
||||
@ -199,6 +202,8 @@ peers.on('connection', async socket => {
|
||||
|
||||
consumer.on('producerclose', () => {
|
||||
console.log('producer of consumer closed', callId)
|
||||
|
||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#router-close
|
||||
router[callId].close()
|
||||
delete router[callId]
|
||||
})
|
||||
@ -281,20 +286,3 @@ const createWebRtcTransportLayer = async (callId, callback) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const closeRoom = (callId) => {
|
||||
console.log('[closeRoom]', callId);
|
||||
// Close transport for producer/consumer
|
||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#Transport-methods
|
||||
// producerTransport.close()
|
||||
// consumerTransport.close()
|
||||
|
||||
// Close producer and consumer
|
||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#producer-close
|
||||
// https://mediasoup.org/documentation/v3/mediasoup-client/api/#consumer-closed
|
||||
producer.close()
|
||||
consumer.close()
|
||||
|
||||
// Reset room
|
||||
delete router[callId]
|
||||
}
|
Loading…
Reference in New Issue
Block a user