LINXD-2329: Don't close the call if initiator or receiver close the transport #28

Closed
sergiu wants to merge 13 commits from LINXD-2329-video-turn-on-camera-after-call-start into develop
4 changed files with 16 additions and 16 deletions

24
app.js
View File

@ -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

View File

@ -20353,7 +20353,7 @@ module.exports = yeast;
},{}],94:[function(require,module,exports){ },{}],94:[function(require,module,exports){
module.exports = { module.exports = {
hubAddress: 'https://hub.dev.linx.safemobile.com/', hubAddress: 'https://hub.dev.linx.safemobile.com/',
mediasoupAddress: 'https://video.safemobile.org', mediasoupAddress: 'https://testing.video.safemobile.org/',
} }
},{}],95:[function(require,module,exports){ },{}],95:[function(require,module,exports){
const io = require('socket.io-client') const io = require('socket.io-client')
@ -20830,7 +20830,7 @@ const connectRecvTransport = async () => {
console.log('remoteVideo PLAY') console.log('remoteVideo PLAY')
}) })
.catch((error) => { .catch((error) => {
displayError(`remoteVideo PLAY ERROR | ${error.message}`) console.log(`remoteVideo PLAY ERROR | ${error.message}`)
}) })
}) })
} }

View File

@ -1,4 +1,4 @@
module.exports = { module.exports = {
hubAddress: 'https://hub.dev.linx.safemobile.com/', hubAddress: 'https://hub.dev.linx.safemobile.com/',
mediasoupAddress: 'https://video.safemobile.org', mediasoupAddress: 'https://testing.video.safemobile.org/',
} }

View File

@ -472,7 +472,7 @@ const connectRecvTransport = async () => {
console.log('remoteVideo PLAY') console.log('remoteVideo PLAY')
}) })
.catch((error) => { .catch((error) => {
displayError(`remoteVideo PLAY ERROR | ${error.message}`) console.log(`remoteVideo PLAY ERROR | ${error.message}`)
}) })
}) })
} }