LH-276: Update producer close event handler
This commit is contained in:
parent
48ef4911b1
commit
0fca614e8e
46
app.js
46
app.js
@ -291,10 +291,10 @@ peers.on('connection', async (socket) => {
|
|||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoCalls[callId].receiverVideoProducer.observer.on("close", () => {
|
// videoCalls[callId].receiverVideoProducer.observer.on("close", () => {
|
||||||
console.log(`[close-producer] receiverVideoProducer receiver --EMIT--> initiator | callId: ${callId} | kind: ${kind}`);
|
// console.log(`[close-producer] receiverVideoProducer receiver --EMIT--> initiator | callId: ${callId} | kind: ${kind}`);
|
||||||
videoCalls[callId].initiatorSocket.emit('close-producer', { callId, kind });
|
// videoCalls[callId].initiatorSocket.emit('close-producer', { callId, kind });
|
||||||
})
|
// })
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
callback &&
|
callback &&
|
||||||
@ -316,10 +316,10 @@ peers.on('connection', async (socket) => {
|
|||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoCalls[callId].initiatorVideoProducer.observer.on("close", () => {
|
// videoCalls[callId].initiatorVideoProducer.observer.on("close", () => {
|
||||||
console.log(`[close-producer] initiatorVideoProducer initiator --EMIT--> receiver | callId: ${callId} | kind: ${kind}`);
|
// console.log(`[close-producer] initiatorVideoProducer initiator --EMIT--> receiver | callId: ${callId} | kind: ${kind}`);
|
||||||
videoCalls[callId].receiverSocket.emit('close-producer', { callId, kind });
|
// videoCalls[callId].receiverSocket.emit('close-producer', { callId, kind });
|
||||||
})
|
// })
|
||||||
|
|
||||||
callback &&
|
callback &&
|
||||||
callback({
|
callback({
|
||||||
@ -342,10 +342,10 @@ peers.on('connection', async (socket) => {
|
|||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoCalls[callId].receiverAudioProducer.observer.on("close", () => {
|
// videoCalls[callId].receiverAudioProducer.observer.on("close", () => {
|
||||||
console.log(`[close-producer] receiverAudioProducer receiver --EMIT--> initiator | callId: ${callId} | kind: ${kind}`);
|
// console.log(`[close-producer] receiverAudioProducer receiver --EMIT--> initiator | callId: ${callId} | kind: ${kind}`);
|
||||||
videoCalls[callId].initiatorSocket.emit('close-producer', { callId, kind });
|
// videoCalls[callId].initiatorSocket.emit('close-producer', { callId, kind });
|
||||||
})
|
// })
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
callback &&
|
callback &&
|
||||||
@ -367,10 +367,10 @@ peers.on('connection', async (socket) => {
|
|||||||
closeCall(callId);
|
closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
videoCalls[callId].initiatorAudioProducer.observer.on("close", () => {
|
// videoCalls[callId].initiatorAudioProducer.observer.on("close", () => {
|
||||||
console.log(`[close-producer] initiatorAudioProducer initiator --EMIT--> receiver | callId: ${callId} | kind: ${kind}`);
|
// console.log(`[close-producer] initiatorAudioProducer initiator --EMIT--> receiver | callId: ${callId} | kind: ${kind}`);
|
||||||
videoCalls[callId].receiverSocket.emit('close-producer', { callId, kind });
|
// videoCalls[callId].receiverSocket.emit('close-producer', { callId, kind });
|
||||||
})
|
// })
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
callback &&
|
callback &&
|
||||||
@ -521,15 +521,19 @@ peers.on('connection', async (socket) => {
|
|||||||
socket.on('close-producer', ({ callId, kind}) => {
|
socket.on('close-producer', ({ callId, kind}) => {
|
||||||
try {
|
try {
|
||||||
console.log(`[close-producer] callId: ${callId} | kind: ${kind}`);
|
console.log(`[close-producer] callId: ${callId} | kind: ${kind}`);
|
||||||
// if (isInitiator(callId, socket.id)) {
|
if (isInitiator(callId, socket.id)) {
|
||||||
// if (kind === 'video') videoCalls[callId].initiatorVideoProducer.close()
|
// if (kind === 'video') {videoCalls[callId].initiatorVideoProducer.close()}
|
||||||
// else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()
|
// else if (kind === 'audio') videoCalls[callId].initiatorAudioProducer.close()
|
||||||
// } else {
|
console.log(`[close-producer] initiator --EMIT--> receiver | callId: ${callId} | kind: ${kind}`);
|
||||||
|
videoCalls[callId].receiverSocket.emit('close-producer', { callId, kind });
|
||||||
|
} else {
|
||||||
// if (kind === 'video') videoCalls[callId].receiverVideoProducer.close()
|
// if (kind === 'video') videoCalls[callId].receiverVideoProducer.close()
|
||||||
// else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close()
|
// else if (kind === 'audio') videoCalls[callId].receiverAudioProducer.close()
|
||||||
// }
|
console.log(`[close-producer] receiver --EMIT--> initiator | callId: ${callId} | kind: ${kind}`);
|
||||||
|
videoCalls[callId].initiatorSocket.emit('close-producer', { callId, kind });
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[close-producer] | ERROR | callId ${socketDetails[socket.id]} | error: ${error.message}`);
|
console.error(`[close-producer] | ERROR | callId: ${socketDetails[socket.id]} | error: ${error.message}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user