LH-276: Update producer close event handler
This commit is contained in:
parent
189c262b32
commit
9560d33870
21
app.js
21
app.js
@ -528,7 +528,7 @@ peers.on('connection', async (socket) => {
|
||||
socket.on('consumer-resume', () => {
|
||||
try {
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`[consumer-resume] callId ${callId}`);
|
||||
console.log(`[consumer-resume] callId: ${callId}`);
|
||||
if (isInitiator(callId, socket.id)) {
|
||||
videoCalls[callId]?.initiatorConsumerVideo?.resume();
|
||||
videoCalls[callId]?.initiatorConsumerAudio?.resume();
|
||||
@ -540,6 +540,25 @@ peers.on('connection', async (socket) => {
|
||||
console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('close-producer', ({ callId, kind}) => {
|
||||
try {
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`[close-producer] callId: ${callId} | kind: kind`);
|
||||
if (isInitiator(callId, socket.id)) {
|
||||
console.log(`[close-producer] initiator`);
|
||||
if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close()
|
||||
else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()
|
||||
} else {
|
||||
console.log(`[close-producer] receiver`);
|
||||
if (kind === 'video') videoCalls[callId].receiverVideoProducer.close()
|
||||
else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
const consumeVideo = async (callId, socketId, rtpCapabilities) => {
|
||||
|
Loading…
Reference in New Issue
Block a user