From d593d6dc834d36f7f576a237b5849a17c5f6938c Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 22 Nov 2022 18:35:36 +0200 Subject: [PATCH] Update build --- public/bundle.js | 138 ++++++++++++++++++++++++----------------------- public/index.js | 138 ++++++++++++++++++++++++----------------------- 2 files changed, 140 insertions(+), 136 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 5695b58..c7c493c 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20376,76 +20376,78 @@ let socket, hub setTimeout(() => { hub = io(config.hubAddress) + + const connectToMediasoup = () => { + + socket = io(config.mediasoupAddress, { + reconnection: true, + reconnectionDelay: 1000, + reconnectionDelayMax : 5000, + reconnectionAttempts: Infinity + }) + + socket.on('connection-success', ({ _socketId, existsProducer }) => { + console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) + if (!IS_PRODUCER && existsProducer && consumer === undefined) { + goConnect() + // document.getElementById('btnRecvSendTransport').click(); + } + if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } + }) + } + + if (IS_PRODUCER === true) { + hub.on('connect', async () => { + console.log(`[HUB]! ${config.hubAddress} | connected: ${hub.connected}`) + connectToMediasoup() + + hub.emit( + 'ars', + JSON.stringify({ + ars: true, + asset_id: ASSET_ID, + account_id: ACCOUNT_ID, + }) + ) + + hub.on('video', (data) => { + const parsedData = JSON.parse(data); + + if (parsedData.type === 'notify-request') { + console.log('video', parsedData) + originAssetId = parsedData.origin_asset_id; + // originAssetName = parsedData.origin_asset_name; + // originAssetTypeName = parsedData.origin_asset_type_name; + callId = parsedData.video_call_id; + + console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId); + getLocalStream() + } + + if (parsedData.type === 'notify-end') { + console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); + resetCallSettings() + } + }) + }) + + hub.on('connect_error', (error) => { + console.log('connect_error', error); + }); + + hub.on('connection', () => { + console.log('connection') + }) + + hub.on('disconnect', () => { + console.log('disconnect') + }) + } else { + connectToMediasoup() + } + }, 2000); -const connectToMediasoup = () => { - - socket = io(config.mediasoupAddress, { - reconnection: true, - reconnectionDelay: 1000, - reconnectionDelayMax : 5000, - reconnectionAttempts: Infinity - }) - - socket.on('connection-success', ({ _socketId, existsProducer }) => { - console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) - if (!IS_PRODUCER && existsProducer && consumer === undefined) { - goConnect() - // document.getElementById('btnRecvSendTransport').click(); - } - if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } - }) -} - -if (IS_PRODUCER === true) { - hub.on('connect', async () => { - console.log(`[HUB]! ${config.hubAddress} | connected: ${hub.connected}`) - connectToMediasoup() - - hub.emit( - 'ars', - JSON.stringify({ - ars: true, - asset_id: ASSET_ID, - account_id: ACCOUNT_ID, - }) - ) - - hub.on('video', (data) => { - const parsedData = JSON.parse(data); - - if (parsedData.type === 'notify-request') { - console.log('video', parsedData) - originAssetId = parsedData.origin_asset_id; - // originAssetName = parsedData.origin_asset_name; - // originAssetTypeName = parsedData.origin_asset_type_name; - callId = parsedData.video_call_id; - - console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId); - getLocalStream() - } - - if (parsedData.type === 'notify-end') { - console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); - resetCallSettings() - } - }) - }) - - hub.on('connect_error', (error) => { - console.log('connect_error', error); - }); - - hub.on('connection', () => { - console.log('connection') - }) - - hub.on('disconnect', () => { - console.log('disconnect') - }) -} else { - connectToMediasoup() -} let device let rtpCapabilities diff --git a/public/index.js b/public/index.js index 5ad8edf..716fa8a 100644 --- a/public/index.js +++ b/public/index.js @@ -18,76 +18,78 @@ let socket, hub setTimeout(() => { hub = io(config.hubAddress) + + const connectToMediasoup = () => { + + socket = io(config.mediasoupAddress, { + reconnection: true, + reconnectionDelay: 1000, + reconnectionDelayMax : 5000, + reconnectionAttempts: Infinity + }) + + socket.on('connection-success', ({ _socketId, existsProducer }) => { + console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) + if (!IS_PRODUCER && existsProducer && consumer === undefined) { + goConnect() + // document.getElementById('btnRecvSendTransport').click(); + } + if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } + }) + } + + if (IS_PRODUCER === true) { + hub.on('connect', async () => { + console.log(`[HUB]! ${config.hubAddress} | connected: ${hub.connected}`) + connectToMediasoup() + + hub.emit( + 'ars', + JSON.stringify({ + ars: true, + asset_id: ASSET_ID, + account_id: ACCOUNT_ID, + }) + ) + + hub.on('video', (data) => { + const parsedData = JSON.parse(data); + + if (parsedData.type === 'notify-request') { + console.log('video', parsedData) + originAssetId = parsedData.origin_asset_id; + // originAssetName = parsedData.origin_asset_name; + // originAssetTypeName = parsedData.origin_asset_type_name; + callId = parsedData.video_call_id; + + console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId); + getLocalStream() + } + + if (parsedData.type === 'notify-end') { + console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); + resetCallSettings() + } + }) + }) + + hub.on('connect_error', (error) => { + console.log('connect_error', error); + }); + + hub.on('connection', () => { + console.log('connection') + }) + + hub.on('disconnect', () => { + console.log('disconnect') + }) + } else { + connectToMediasoup() + } + }, 2000); -const connectToMediasoup = () => { - - socket = io(config.mediasoupAddress, { - reconnection: true, - reconnectionDelay: 1000, - reconnectionDelayMax : 5000, - reconnectionAttempts: Infinity - }) - - socket.on('connection-success', ({ _socketId, existsProducer }) => { - console.log(`[MEDIA] ${config.mediasoupAddress} | connected: ${socket.connected} | existsProducer: ${existsProducer}`) - if (!IS_PRODUCER && existsProducer && consumer === undefined) { - goConnect() - // document.getElementById('btnRecvSendTransport').click(); - } - if (IS_PRODUCER && urlParams.get('testing') === 'true') { getLocalStream() } - }) -} - -if (IS_PRODUCER === true) { - hub.on('connect', async () => { - console.log(`[HUB]! ${config.hubAddress} | connected: ${hub.connected}`) - connectToMediasoup() - - hub.emit( - 'ars', - JSON.stringify({ - ars: true, - asset_id: ASSET_ID, - account_id: ACCOUNT_ID, - }) - ) - - hub.on('video', (data) => { - const parsedData = JSON.parse(data); - - if (parsedData.type === 'notify-request') { - console.log('video', parsedData) - originAssetId = parsedData.origin_asset_id; - // originAssetName = parsedData.origin_asset_name; - // originAssetTypeName = parsedData.origin_asset_type_name; - callId = parsedData.video_call_id; - - console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId); - getLocalStream() - } - - if (parsedData.type === 'notify-end') { - console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); - resetCallSettings() - } - }) - }) - - hub.on('connect_error', (error) => { - console.log('connect_error', error); - }); - - hub.on('connection', () => { - console.log('connection') - }) - - hub.on('disconnect', () => { - console.log('disconnect') - }) -} else { - connectToMediasoup() -} let device let rtpCapabilities