LH-276: Update producer close event handler
This commit is contained in:
parent
2098fbdd89
commit
76d93e97b1
12
app.js
12
app.js
@ -492,8 +492,11 @@ peers.on('connection', async (socket) => {
|
||||
socket.on('consumer-resume', () => {
|
||||
try {
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`[consumer-resume] callId: ${callId}`);
|
||||
if (isInitiator(callId, socket.id)) {
|
||||
const isInitiator = isInitiator(callId, socket.id);
|
||||
console.log(`[consumer-resume] callId: ${callId} | isInitiator: ${isInitiator}`);
|
||||
console.log('videoCalls[callId]?.receiverConsumerVideo?', videoCalls[callId]?.receiverConsumerVideo);
|
||||
console.log('videoCalls[callId]?.receiverConsumerAudio', videoCalls[callId]?.receiverConsumerAudio);
|
||||
if (isInitiator) {
|
||||
videoCalls[callId]?.initiatorConsumerVideo?.resume();
|
||||
videoCalls[callId]?.initiatorConsumerAudio?.resume();
|
||||
} else {
|
||||
@ -501,14 +504,13 @@ peers.on('connection', async (socket) => {
|
||||
videoCalls[callId]?.receiverConsumerAudio?.resume();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`ERROR | consumer-resume | callId ${socketDetails[socket.id]} | ${error.message}`);
|
||||
console.error(`[consumer-resume] | ERROR | callId: ${callId} | isInitiator: ${isInitiator} | error: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('close-producer', ({ callId, kind}) => {
|
||||
try {
|
||||
const callId = socketDetails[socket.id];
|
||||
console.log(`[close-producer] callId: ${callId} | kind: kind`);
|
||||
console.log(`[close-producer] callId: ${callId} | kind: ${kind}`);
|
||||
if (isInitiator(callId, socket.id)) {
|
||||
if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close()
|
||||
else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()
|
||||
|
Loading…
Reference in New Issue
Block a user