Refactor transportclose 11
This commit is contained in:
parent
6147d3bede
commit
0f1c268fa5
21
app.js
21
app.js
@ -160,6 +160,7 @@ peers.on('connection', async socket => {
|
|||||||
producer.on('transportclose', () => {
|
producer.on('transportclose', () => {
|
||||||
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
|
||||||
@ -190,10 +191,11 @@ peers.on('connection', async socket => {
|
|||||||
|
|
||||||
consumer.on('transportclose', () => {
|
consumer.on('transportclose', () => {
|
||||||
console.log('transport close from consumer', callId)
|
console.log('transport close from consumer', callId)
|
||||||
|
router[callId] = null
|
||||||
})
|
})
|
||||||
|
|
||||||
consumer.on('producerclose', () => {
|
consumer.on('producerclose', () => {
|
||||||
console.log('producer of consumer closed', callId)
|
console.log('producer of consumer closed')
|
||||||
})
|
})
|
||||||
|
|
||||||
// from the consumer extract the following params
|
// from the consumer extract the following params
|
||||||
@ -224,23 +226,6 @@ peers.on('connection', async socket => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
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
|
|
||||||
router[callId] = null
|
|
||||||
}
|
|
||||||
|
|
||||||
const createWebRtcTransportLayer = async (callId, callback) => {
|
const createWebRtcTransportLayer = async (callId, callback) => {
|
||||||
try {
|
try {
|
||||||
// https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions
|
// https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions
|
||||||
|
Loading…
Reference in New Issue
Block a user