LINXD-2329: Don't close the call if initiator or receiver close the transport
This commit is contained in:
parent
6eca0808c9
commit
6b1bf17f6d
24
app.js
24
app.js
@ -223,18 +223,18 @@ peers.on('connection', async (socket) => {
|
|||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
|
console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`);
|
||||||
if (sender) {
|
if (sender) {
|
||||||
if (!videoCalls[callId].receiverProducerTransport && !isInitiator(callId, socket.id)) {
|
if (!isInitiator(callId, socket.id)) {
|
||||||
videoCalls[callId].receiverProducerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].receiverProducerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
} else if (!videoCalls[callId].initiatorProducerTransport && isInitiator(callId, socket.id)) {
|
} else if (isInitiator(callId, socket.id)) {
|
||||||
videoCalls[callId].initiatorProducerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].initiatorProducerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
} else {
|
} else {
|
||||||
console.log(`producerTransport has already been defined | callId ${callId}`);
|
console.log(`producerTransport has already been defined | callId ${callId}`);
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
} else if (!sender) {
|
} else if (!sender) {
|
||||||
if (!videoCalls[callId].receiverConsumerTransport && !isInitiator(callId, socket.id)) {
|
if (!isInitiator(callId, socket.id)) {
|
||||||
videoCalls[callId].receiverConsumerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].receiverConsumerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
} else if (!videoCalls[callId].initiatorConsumerTransport && isInitiator(callId, socket.id)) {
|
} else if (isInitiator(callId, socket.id)) {
|
||||||
videoCalls[callId].initiatorConsumerTransport = await createWebRtcTransportLayer(callId, callback);
|
videoCalls[callId].initiatorConsumerTransport = await createWebRtcTransportLayer(callId, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,8 +291,8 @@ peers.on('connection', async (socket) => {
|
|||||||
|
|
||||||
videoCalls[callId].receiverVideoProducer.on('transportclose', () => {
|
videoCalls[callId].receiverVideoProducer.on('transportclose', () => {
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log('transport for this producer closed', callId);
|
console.log('[receiverVideoProducer] transport for this producer closed', callId);
|
||||||
closeCall(callId);
|
// closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
@ -312,8 +312,8 @@ peers.on('connection', async (socket) => {
|
|||||||
|
|
||||||
videoCalls[callId].initiatorVideoProducer.on('transportclose', () => {
|
videoCalls[callId].initiatorVideoProducer.on('transportclose', () => {
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log('transport for this producer closed', callId);
|
console.log('[initiatorVideoProducer] transport for this producer closed', callId);
|
||||||
closeCall(callId);
|
// closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
callback &&
|
callback &&
|
||||||
@ -334,8 +334,8 @@ peers.on('connection', async (socket) => {
|
|||||||
|
|
||||||
videoCalls[callId].receiverAudioProducer.on('transportclose', () => {
|
videoCalls[callId].receiverAudioProducer.on('transportclose', () => {
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log('transport for this producer closed', callId);
|
console.log('[receiverAudioProducer] transport for this producer closed', callId);
|
||||||
closeCall(callId);
|
// closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
@ -355,8 +355,8 @@ peers.on('connection', async (socket) => {
|
|||||||
|
|
||||||
videoCalls[callId].initiatorAudioProducer.on('transportclose', () => {
|
videoCalls[callId].initiatorAudioProducer.on('transportclose', () => {
|
||||||
const callId = socketDetails[socket.id];
|
const callId = socketDetails[socket.id];
|
||||||
console.log('transport for this producer closed', callId);
|
console.log('[initiatorAudioProducer] transport for this producer closed', callId);
|
||||||
closeCall(callId);
|
// closeCall(callId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send back to the client the Producer's id
|
// Send back to the client the Producer's id
|
||||||
|
Loading…
Reference in New Issue
Block a user