diff --git a/public/config.js b/public/config.js index 2a1ddaf..d2e2d91 100644 --- a/public/config.js +++ b/public/config.js @@ -1,5 +1,4 @@ module.exports = { hubAddress: 'https://hub.dev.linx.safemobile.com/', mediasoupAddress: 'https://video.safemobile.org/mediasoup', -} - +} \ No newline at end of file diff --git a/public/index.js b/public/index.js index e56f28b..c30f4d1 100644 --- a/public/index.js +++ b/public/index.js @@ -43,17 +43,24 @@ if (IS_PRODUCER === true) { 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('IS_PRODUCER', IS_PRODUCER, 'callId', callId); - - if (parsedData.type === 'notify-request' && IS_PRODUCER) { + console.log('[VIDEO] notify-request | IS_PRODUCER', IS_PRODUCER, 'callId', callId); getLocalStream() } + + if (parsedData.type === 'notify-end') { + remoteVideo.srcObject = null; + console.log('[VIDEO] notify-end | IS_PRODUCER', IS_PRODUCER, 'callId', callId); + // socket.emit('transportclose') + socket.emit('transportclose') + } }) }) @@ -261,7 +268,6 @@ const connectSendTransport = async () => { producer.on('trackended', () => { console.log('track ended') - // close video track })