From 3f3048e54f512425eb9e624f7a846e406cf098b3 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Thu, 11 Aug 2022 13:17:44 +0300 Subject: [PATCH] Refactor transportclose 8 --- public/index.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/public/index.js b/public/index.js index 26d8cc8..affb71b 100644 --- a/public/index.js +++ b/public/index.js @@ -350,8 +350,6 @@ const createRecvTransport = async () => { } const resetCallSettings = () => { - console.log('resetCallSettings', callId, 'socket |', socket); - socket.emit('transportclose') localVideo.srcObject = null remoteVideo.srcObject = null consumer = null @@ -398,24 +396,24 @@ const connectRecvTransport = async () => { } const closeCall = () => { - console.log('closeCall', callId); - // socket.emit('transportclose') - // Reset settings and send closeTransport to video server - resetCallSettings() + console.log('closeCall'); - // // Emit 'notify-end' to Hub so the consumer will know to close the video - // const notifyEnd = { - // origin_asset_id: ASSET_ID, - // dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), - // type: 'notify-end', - // video_call_id: callId - // } - // console.log('notifyEnd', notifyEnd) - // hub.emit('video', JSON.stringify(notifyEnd)) + // Emit 'notify-end' to Hub so the consumer will know to close the video + const notifyEnd = { + origin_asset_id: ASSET_ID, + dest_asset_id: originAssetId || parseInt(urlParams.get('dest_asset_id')), + type: 'notify-end', + video_call_id: callId + } + console.log('notifyEnd', notifyEnd) + hub.emit('video', JSON.stringify(notifyEnd)) - // // Disable Close call button - // const closeCallBtn = document.getElementById('btnCloseCall') - // closeCallBtn.setAttribute('disabled', '') + // Disable Close call button + const closeCallBtn = document.getElementById('btnCloseCall') + closeCallBtn.setAttribute('disabled', '') + + // Reset settings + resetCallSettings() } btnLocalVideo.addEventListener('click', getLocalStream)