From 50e95b93a448dc47438d12079048081a6e8c799d Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 8 Feb 2023 19:37:32 +0200 Subject: [PATCH 1/6] Update 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..aa7ab9f 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..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://video.safemobile.org', + mediasoupAddress: 'https://testing.video.safemobile.org/', } \ No newline at end of file From 6b822142d039164ace460770abc8a59e76a30467 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 11 Feb 2023 21:13:57 +0200 Subject: [PATCH 2/6] Add the kind of producer on new-producer event --- app.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app.js b/app.js index 5359aa8..3ed9f2b 100644 --- a/app.js +++ b/app.js @@ -260,7 +260,6 @@ peers.on('connection', async (socket) => { isInitiator(callId, socket.id) ? await videoCalls[callId].initiatorProducerTransport.connect({ dtlsParameters }) : await videoCalls[callId].receiverProducerTransport.connect({ dtlsParameters }); - } catch (error) { console.log(`ERROR | transport-connect | callId ${socketDetails[socket.id]} | ${error.message}`); } @@ -370,8 +369,8 @@ peers.on('connection', async (socket) => { const socketToEmit = isInitiator(callId, socket.id) ? videoCalls[callId].receiverSocket : videoCalls[callId].initiatorSocket; - socketToEmit.emit('new-producer', { callId }); + socketToEmit.emit('new-producer', { callId, kind }); } catch (error) { console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`); } From 33ea44ac02de38a563df605feadb6b1b38549369 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 11 Feb 2023 21:30:21 +0200 Subject: [PATCH 3/6] Update client to consume audio correctly --- public/bundle.js | 55 +++++++++++++++++++++++++----------------------- public/index.js | 55 +++++++++++++++++++++++++----------------------- 2 files changed, 58 insertions(+), 52 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index aa7ab9f..e7f4484 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20453,9 +20453,9 @@ setTimeout(() => { if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } }) - socket.on('new-producer', ({ callId }) => { - console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + socket.on('new-producer', ({ callId, kind }) => { + console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`); + connectRecvTransport(); }) } @@ -20735,6 +20735,8 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); + + createRecvTransport(); } const createRecvTransport = async () => { @@ -20774,7 +20776,8 @@ const createRecvTransport = async () => { errback(error) } }) - connectRecvTransport() + // We call it in new-rpoducer, we don't need it here anymore + // connectRecvTransport() }) } @@ -20907,29 +20910,29 @@ const closeCall = () => { resetCallSettings() } -const consume = async () => { - console.log('[consume]') - console.log('createRecvTransport Consumer') - await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => { - if (params.error) { - console.log('createRecvTransport | createWebRtcTransport | Error', params.error) - return - } - consumerTransport = device.createRecvTransport(params) - consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => { - try { - await socket.emit('transport-recv-connect', { - dtlsParameters, - }) - callback() - } catch (error) { - errback(error) - } - }) +// const consume = async (kind) => { +// console.log(`[consume] kind: ${kind}`) +// console.log('createRecvTransport Consumer') +// await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => { +// if (params.error) { +// console.log('createRecvTransport | createWebRtcTransport | Error', params.error) +// return +// } +// consumerTransport = device.createRecvTransport(params) +// consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => { +// try { +// await socket.emit('transport-recv-connect', { +// dtlsParameters, +// }) +// callback() +// } catch (error) { +// errback(error) +// } +// }) - connectRecvTransport() - }) -} +// connectRecvTransport() +// }) +// } btnLocalVideo.addEventListener('click', getLocalStream) btnRecvSendTransport.addEventListener('click', consume) diff --git a/public/index.js b/public/index.js index 1fbf13a..ddb2c0b 100644 --- a/public/index.js +++ b/public/index.js @@ -95,9 +95,9 @@ setTimeout(() => { if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } }) - socket.on('new-producer', ({ callId }) => { - console.log(`🟢 new-producer | callId: ${callId} | Ready to consume`); - consume() + socket.on('new-producer', ({ callId, kind }) => { + console.log(`🟢 new-producer | callId: ${callId} | kind: ${kind} | Ready to consume`); + connectRecvTransport(); }) } @@ -377,6 +377,8 @@ const connectSendTransport = async () => { // Enable Close call button const closeCallBtn = document.getElementById('btnCloseCall'); closeCallBtn.removeAttribute('disabled'); + + createRecvTransport(); } const createRecvTransport = async () => { @@ -416,7 +418,8 @@ const createRecvTransport = async () => { errback(error) } }) - connectRecvTransport() + // We call it in new-rpoducer, we don't need it here anymore + // connectRecvTransport() }) } @@ -549,29 +552,29 @@ const closeCall = () => { resetCallSettings() } -const consume = async () => { - console.log('[consume]') - console.log('createRecvTransport Consumer') - await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => { - if (params.error) { - console.log('createRecvTransport | createWebRtcTransport | Error', params.error) - return - } - consumerTransport = device.createRecvTransport(params) - consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => { - try { - await socket.emit('transport-recv-connect', { - dtlsParameters, - }) - callback() - } catch (error) { - errback(error) - } - }) +// const consume = async (kind) => { +// console.log(`[consume] kind: ${kind}`) +// console.log('createRecvTransport Consumer') +// await socket.emit('createWebRtcTransport', { sender: false, callId, dispatcher: true }, ({ params }) => { +// if (params.error) { +// console.log('createRecvTransport | createWebRtcTransport | Error', params.error) +// return +// } +// consumerTransport = device.createRecvTransport(params) +// consumerTransport.on('connect', async ({ dtlsParameters }, callback, errback) => { +// try { +// await socket.emit('transport-recv-connect', { +// dtlsParameters, +// }) +// callback() +// } catch (error) { +// errback(error) +// } +// }) - connectRecvTransport() - }) -} +// connectRecvTransport() +// }) +// } btnLocalVideo.addEventListener('click', getLocalStream) btnRecvSendTransport.addEventListener('click', consume) From 98212a78cb21424e100bf5f6fafe20003345e7bd Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Sat, 11 Feb 2023 21:32:53 +0200 Subject: [PATCH 4/6] Update client to consume audio correctly --- public/bundle.js | 2 +- public/index.html | 2 +- public/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index e7f4484..fbf3a9c 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20935,6 +20935,6 @@ const closeCall = () => { // } btnLocalVideo.addEventListener('click', getLocalStream) -btnRecvSendTransport.addEventListener('click', consume) +// btnRecvSendTransport.addEventListener('click', consume) btnCloseCall.addEventListener('click', closeCall) },{"./config":94,"mediasoup-client":66,"socket.io-client":82}]},{},[95]); diff --git a/public/index.html b/public/index.html index a44cd99..d8ce60e 100644 --- a/public/index.html +++ b/public/index.html @@ -75,7 +75,7 @@
- +
diff --git a/public/index.js b/public/index.js index ddb2c0b..0fdb4f0 100644 --- a/public/index.js +++ b/public/index.js @@ -577,5 +577,5 @@ const closeCall = () => { // } btnLocalVideo.addEventListener('click', getLocalStream) -btnRecvSendTransport.addEventListener('click', consume) +// btnRecvSendTransport.addEventListener('click', consume) btnCloseCall.addEventListener('click', closeCall) \ No newline at end of file From 7ee93d7963654744299042efae603d535dd79e3c Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 15 Feb 2023 10:06:39 +0200 Subject: [PATCH 5/6] LINXD-2342: Update video 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 fbf3a9c..ee7b33e 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://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 233f24c..4d1b6a4 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://video.safemobile.org/', } \ No newline at end of file From f02d6af7262646e13b2306507583be4c14dd998e Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Wed, 15 Feb 2023 11:14:02 +0200 Subject: [PATCH 6/6] LINXD-2342: Added documentation for kind --- app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.js b/app.js index 3ed9f2b..7e97cec 100644 --- a/app.js +++ b/app.js @@ -370,6 +370,8 @@ peers.on('connection', async (socket) => { ? videoCalls[callId].receiverSocket : videoCalls[callId].initiatorSocket; + // callId - Id of the call + // kind - producer type: audio/video socketToEmit.emit('new-producer', { callId, kind }); } catch (error) { console.log(`ERROR | transport-produce | callId ${socketDetails[socket.id]} | ${error.message}`);