From 6b1bf17f6d6a4acf457ad859a9097bd9082572f7 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 01:17:34 +0200 Subject: [PATCH 01/13] LINXD-2329: Don't close the call if initiator or receiver close the transport --- app.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 5359aa8..d5c538f 100644 --- a/app.js +++ b/app.js @@ -223,18 +223,18 @@ peers.on('connection', async (socket) => { const callId = socketDetails[socket.id]; console.log(`[createWebRtcTransport] socket ${socket.id} | sender ${sender} | callId ${callId}`); if (sender) { - if (!videoCalls[callId].receiverProducerTransport && !isInitiator(callId, socket.id)) { + if (!isInitiator(callId, socket.id)) { 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); } else { console.log(`producerTransport has already been defined | callId ${callId}`); callback(null); } } else if (!sender) { - if (!videoCalls[callId].receiverConsumerTransport && !isInitiator(callId, socket.id)) { + if (!isInitiator(callId, socket.id)) { 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); } } @@ -291,8 +291,8 @@ peers.on('connection', async (socket) => { videoCalls[callId].receiverVideoProducer.on('transportclose', () => { const callId = socketDetails[socket.id]; - console.log('transport for this producer closed', callId); - closeCall(callId); + console.log('[receiverVideoProducer] transport for this producer closed', callId); + // closeCall(callId); }); // Send back to the client the Producer's id @@ -312,8 +312,8 @@ peers.on('connection', async (socket) => { videoCalls[callId].initiatorVideoProducer.on('transportclose', () => { const callId = socketDetails[socket.id]; - console.log('transport for this producer closed', callId); - closeCall(callId); + console.log('[initiatorVideoProducer] transport for this producer closed', callId); + // closeCall(callId); }); callback && @@ -334,8 +334,8 @@ peers.on('connection', async (socket) => { videoCalls[callId].receiverAudioProducer.on('transportclose', () => { const callId = socketDetails[socket.id]; - console.log('transport for this producer closed', callId); - closeCall(callId); + console.log('[receiverAudioProducer] transport for this producer closed', callId); + // closeCall(callId); }); // Send back to the client the Producer's id @@ -355,8 +355,8 @@ peers.on('connection', async (socket) => { videoCalls[callId].initiatorAudioProducer.on('transportclose', () => { const callId = socketDetails[socket.id]; - console.log('transport for this producer closed', callId); - closeCall(callId); + console.log('[initiatorAudioProducer] transport for this producer closed', callId); + // closeCall(callId); }); // Send back to the client the Producer's id -- 2.37.1 From 019c835976ea8738f9f458d483c392f475f6fb4b Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 02:51:35 +0200 Subject: [PATCH 02/13] Update web client --- public/bundle.js | 2 +- public/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 85de9b9..9ef331f 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20353,7 +20353,7 @@ module.exports = yeast; },{}],94:[function(require,module,exports){ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', - mediasoupAddress: 'https://video.safemobile.org', + mediasoupAddress: 'https://testing.video.safemobile.org', } },{}],95:[function(require,module,exports){ const io = require('socket.io-client') diff --git a/public/config.js b/public/config.js index fa3612f..f631fc8 100644 --- a/public/config.js +++ b/public/config.js @@ -1,4 +1,4 @@ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', - mediasoupAddress: 'https://video.safemobile.org', + mediasoupAddress: 'https://testing.video.safemobile.org', } \ No newline at end of file -- 2.37.1 From 71b9c71ae1328e166b15a2ed4d62235eef3755d5 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 02:54:49 +0200 Subject: [PATCH 03/13] Update Client show error correctly --- public/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.js b/public/index.js index 1fbf13a..04091d5 100644 --- a/public/index.js +++ b/public/index.js @@ -472,7 +472,7 @@ const connectRecvTransport = async () => { console.log('remoteVideo PLAY') }) .catch((error) => { - displayError(`remoteVideo PLAY ERROR | ${error.message}`) + console.log(`remoteVideo PLAY ERROR | ${error.message}`) }) }) } -- 2.37.1 From e79e0be6ecdfca43d32a4e4ad881c08edbbee619 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 02:56:35 +0200 Subject: [PATCH 04/13] Update Client show error correctly --- public/bundle.js | 4 ++-- public/config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 9ef331f..c0b729b 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20353,7 +20353,7 @@ module.exports = yeast; },{}],94:[function(require,module,exports){ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', - mediasoupAddress: 'https://testing.video.safemobile.org', + mediasoupAddress: 'https://testing.video.safemobile.org/', } },{}],95:[function(require,module,exports){ const io = require('socket.io-client') @@ -20830,7 +20830,7 @@ const connectRecvTransport = async () => { console.log('remoteVideo PLAY') }) .catch((error) => { - displayError(`remoteVideo PLAY ERROR | ${error.message}`) + console.log(`remoteVideo PLAY ERROR | ${error.message}`) }) }) } diff --git a/public/config.js b/public/config.js index f631fc8..233f24c 100644 --- a/public/config.js +++ b/public/config.js @@ -1,4 +1,4 @@ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', - mediasoupAddress: 'https://testing.video.safemobile.org', + mediasoupAddress: 'https://testing.video.safemobile.org/', } \ No newline at end of file -- 2.37.1 From df0c73badb94b704159f0748f495da6116dde8d7 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:14:43 +0200 Subject: [PATCH 05/13] Update Client show error correctly --- public/bundle.js | 14 +++++++------- public/index.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index c0b729b..ab44688 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20825,13 +20825,13 @@ const connectRecvTransport = async () => { remoteVideo.srcObject = stream remoteVideo.setAttribute('autoplay', true) - remoteVideo.play() - .then(() => { - console.log('remoteVideo PLAY') - }) - .catch((error) => { - console.log(`remoteVideo PLAY ERROR | ${error.message}`) - }) + // remoteVideo.play() + // .then(() => { + // console.log('remoteVideo PLAY') + // }) + // .catch((error) => { + // console.log(`remoteVideo PLAY ERROR | ${error.message}`) + // }) }) } diff --git a/public/index.js b/public/index.js index 04091d5..46a3eb8 100644 --- a/public/index.js +++ b/public/index.js @@ -467,13 +467,13 @@ const connectRecvTransport = async () => { remoteVideo.srcObject = stream remoteVideo.setAttribute('autoplay', true) - remoteVideo.play() - .then(() => { - console.log('remoteVideo PLAY') - }) - .catch((error) => { - console.log(`remoteVideo PLAY ERROR | ${error.message}`) - }) + // remoteVideo.play() + // .then(() => { + // console.log('remoteVideo PLAY') + // }) + // .catch((error) => { + // console.log(`remoteVideo PLAY ERROR | ${error.message}`) + // }) }) } -- 2.37.1 From c38d2083539761eec8b3a746bb6c6bbf9196067b Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:17:05 +0200 Subject: [PATCH 06/13] Update Client show error correctly --- public/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/index.js b/public/index.js index 46a3eb8..9c5c35e 100644 --- a/public/index.js +++ b/public/index.js @@ -97,7 +97,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + !consumerTransport && consume() }) } @@ -467,13 +467,13 @@ const connectRecvTransport = async () => { remoteVideo.srcObject = stream remoteVideo.setAttribute('autoplay', true) - // remoteVideo.play() - // .then(() => { - // console.log('remoteVideo PLAY') - // }) - // .catch((error) => { - // console.log(`remoteVideo PLAY ERROR | ${error.message}`) - // }) + remoteVideo.play() + .then(() => { + console.log('remoteVideo PLAY') + }) + .catch((error) => { + console.log(`remoteVideo PLAY ERROR | ${error.message}`) + }) }) } -- 2.37.1 From 55bae8b2ed3022431bf0a6dbabcccb5edb14000e Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:18:00 +0200 Subject: [PATCH 07/13] Update Client show error correctly --- public/bundle.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index ab44688..e2b6ff0 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20455,7 +20455,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + !consumerTransport && consume() }) } @@ -20825,13 +20825,13 @@ const connectRecvTransport = async () => { remoteVideo.srcObject = stream remoteVideo.setAttribute('autoplay', true) - // remoteVideo.play() - // .then(() => { - // console.log('remoteVideo PLAY') - // }) - // .catch((error) => { - // console.log(`remoteVideo PLAY ERROR | ${error.message}`) - // }) + remoteVideo.play() + .then(() => { + console.log('remoteVideo PLAY') + }) + .catch((error) => { + console.log(`remoteVideo PLAY ERROR | ${error.message}`) + }) }) } -- 2.37.1 From 7474b083e2dbb0ead7eeaa8cb542f7035dcd7d92 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:24:08 +0200 Subject: [PATCH 08/13] Update Client show error correctly --- public/bundle.js | 3 ++- public/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index e2b6ff0..5318496 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20455,7 +20455,8 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - !consumerTransport && consume() + remoteVideo.play() + consume() }) } diff --git a/public/index.js b/public/index.js index 9c5c35e..bf4acdb 100644 --- a/public/index.js +++ b/public/index.js @@ -97,7 +97,8 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - !consumerTransport && consume() + remoteVideo.play() + consume() }) } -- 2.37.1 From 6ae0c3571e0a808e3b51c0449755a2166f4a154d Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:28:15 +0200 Subject: [PATCH 09/13] Update Client show error correctly --- public/bundle.js | 5 ++++- public/index.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 5318496..13152d4 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20455,7 +20455,6 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - remoteVideo.play() consume() }) } @@ -20580,6 +20579,10 @@ const createDevice = async () => { routerRtpCapabilities: rtpCapabilities }) + device.observer.on("newtransport", (transport) => { + console.log("new transport created [id:%s]", transport.id); + }); + console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); diff --git a/public/index.js b/public/index.js index bf4acdb..d2b5a3c 100644 --- a/public/index.js +++ b/public/index.js @@ -97,7 +97,6 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - remoteVideo.play() consume() }) } @@ -222,6 +221,10 @@ const createDevice = async () => { routerRtpCapabilities: rtpCapabilities }) + device.observer.on("newtransport", (transport) => { + console.log("new transport created [id:%s]", transport.id); + }); + console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); -- 2.37.1 From acabe9eb81119037bd6d89045d468f281dc237c3 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:32:47 +0200 Subject: [PATCH 10/13] Update Client show error correctly --- public/bundle.js | 9 +++++---- public/index.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 13152d4..228a74b 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20359,7 +20359,8 @@ module.exports = { const io = require('socket.io-client') const mediasoupClient = require('mediasoup-client') const urlParams = new URLSearchParams(location.search); -const config = require('./config') +const config = require('./config'); +const { connect } = require('socket.io-client'); console.log('[CONFIG]', config); const ASSET_ID = parseInt(urlParams.get('assetId')) || null; @@ -20455,7 +20456,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + // consume() }) } @@ -20580,8 +20581,8 @@ const createDevice = async () => { }) device.observer.on("newtransport", (transport) => { - console.log("new transport created [id:%s]", transport.id); - }); + consume() + }) console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); diff --git a/public/index.js b/public/index.js index d2b5a3c..97d1f1b 100644 --- a/public/index.js +++ b/public/index.js @@ -1,7 +1,8 @@ const io = require('socket.io-client') const mediasoupClient = require('mediasoup-client') const urlParams = new URLSearchParams(location.search); -const config = require('./config') +const config = require('./config'); +const { connect } = require('socket.io-client'); console.log('[CONFIG]', config); const ASSET_ID = parseInt(urlParams.get('assetId')) || null; @@ -97,7 +98,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + // consume() }) } @@ -222,8 +223,8 @@ const createDevice = async () => { }) device.observer.on("newtransport", (transport) => { - console.log("new transport created [id:%s]", transport.id); - }); + consume() + }) console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); -- 2.37.1 From fadf65c184c216537ea0f3d934c36d33157d8cc8 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:42:00 +0200 Subject: [PATCH 11/13] Update Client show error correctly --- public/bundle.js | 16 ++++++++-------- public/index.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 228a74b..a181dae 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20359,8 +20359,7 @@ module.exports = { const io = require('socket.io-client') const mediasoupClient = require('mediasoup-client') const urlParams = new URLSearchParams(location.search); -const config = require('./config'); -const { connect } = require('socket.io-client'); +const config = require('./config') console.log('[CONFIG]', config); const ASSET_ID = parseInt(urlParams.get('assetId')) || null; @@ -20456,7 +20455,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - // consume() + // consume() }) } @@ -20580,10 +20579,6 @@ const createDevice = async () => { routerRtpCapabilities: rtpCapabilities }) - device.observer.on("newtransport", (transport) => { - consume() - }) - console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); @@ -20740,6 +20735,7 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); + consume() } const createRecvTransport = async () => { @@ -20779,7 +20775,11 @@ const createRecvTransport = async () => { errback(error) } }) - connectRecvTransport() + + consumerTransport.observer.on("newproducer", (producer) => { + console.log("new producer created [id:%s]", producer.id); + }); + // connectRecvTransport() }) } diff --git a/public/index.js b/public/index.js index 97d1f1b..55e3226 100644 --- a/public/index.js +++ b/public/index.js @@ -1,8 +1,7 @@ const io = require('socket.io-client') const mediasoupClient = require('mediasoup-client') const urlParams = new URLSearchParams(location.search); -const config = require('./config'); -const { connect } = require('socket.io-client'); +const config = require('./config') console.log('[CONFIG]', config); const ASSET_ID = parseInt(urlParams.get('assetId')) || null; @@ -98,7 +97,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - // consume() + // consume() }) } @@ -222,10 +221,6 @@ const createDevice = async () => { routerRtpCapabilities: rtpCapabilities }) - device.observer.on("newtransport", (transport) => { - consume() - }) - console.log('Device RTP Capabilities', device.rtpCapabilities) console.log('[createDevice] device', device); @@ -382,6 +377,7 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); + consume() } const createRecvTransport = async () => { @@ -421,7 +417,11 @@ const createRecvTransport = async () => { errback(error) } }) - connectRecvTransport() + + consumerTransport.observer.on("newproducer", (producer) => { + console.log("new producer created [id:%s]", producer.id); + }); + // connectRecvTransport() }) } -- 2.37.1 From bf18906cb76f040ab049549ef9c7f68231eafffc Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:46:38 +0200 Subject: [PATCH 12/13] Update Client show error correctly --- public/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/index.js b/public/index.js index 55e3226..19fe1a0 100644 --- a/public/index.js +++ b/public/index.js @@ -377,7 +377,8 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); - consume() + // consume() + createRecvTransport() } const createRecvTransport = async () => { -- 2.37.1 From 0a2305bcf565bd8750791273b7dd15398f37056c Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 03:48:43 +0200 Subject: [PATCH 13/13] Update Client show error correctly --- public/bundle.js | 9 ++------- public/index.js | 10 ++-------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index a181dae..c0b729b 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20455,7 +20455,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - // consume() + consume() }) } @@ -20735,7 +20735,6 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); - consume() } const createRecvTransport = async () => { @@ -20775,11 +20774,7 @@ const createRecvTransport = async () => { errback(error) } }) - - consumerTransport.observer.on("newproducer", (producer) => { - console.log("new producer created [id:%s]", producer.id); - }); - // connectRecvTransport() + connectRecvTransport() }) } diff --git a/public/index.js b/public/index.js index 19fe1a0..04091d5 100644 --- a/public/index.js +++ b/public/index.js @@ -97,7 +97,7 @@ setTimeout(() => { socket.on('new-producer', ({ callId }) => { console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - // consume() + consume() }) } @@ -377,8 +377,6 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); - // consume() - createRecvTransport() } const createRecvTransport = async () => { @@ -418,11 +416,7 @@ const createRecvTransport = async () => { errback(error) } }) - - consumerTransport.observer.on("newproducer", (producer) => { - console.log("new producer created [id:%s]", producer.id); - }); - // connectRecvTransport() + connectRecvTransport() }) } -- 2.37.1