From 3bc15fdef119c4d3859ff14e5b50d457a41e3d47 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 29 Nov 2022 02:09:37 +0200 Subject: [PATCH] Update server --- public/bundle.js | 27 +++++++++++++++------------ public/index.js | 27 +++++++++++++++------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 335f81d..5ef5243 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20372,7 +20372,8 @@ console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', console.log('🟩 config', config) -let socket, hub +let socket, hub, having +let doIHaveAudio = false setTimeout(() => { hub = io(config.hubAddress) @@ -20549,20 +20550,22 @@ const getLocalStream = () => { }) navigator.permissions.query( - // { name: 'camera' } { name: 'microphone' } - // { name: 'geolocation' } - // { name: 'notifications' } - // { name: 'midi', sysex: false } - // { name: 'midi', sysex: true } - // { name: 'push', userVisibleOnly: true } - // { name: 'push' } // without userVisibleOnly isn't supported in chrome M45, yet - ).then(function(permissionStatus){ + ).then(function(permissionStatus) { + + console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt - console.log(permissionStatus.state); // granted, denied, prompt + // If he has entered before, the saved access is already saved + if (permissionStatus === 'grated') { + doIHaveAudio = true; + } - permissionStatus.onchange = function(){ - console.log("Permission changed to " + this.state); + // If it is the first time client enter and give permission + permissionStatus.onchange = function() { + console.log('🟨 [PERMISSION] onchange', this.state); + if (this.state === 'grated') { + doIHaveAudio = true; + } } }) diff --git a/public/index.js b/public/index.js index bf3f6fe..679cf0d 100644 --- a/public/index.js +++ b/public/index.js @@ -14,7 +14,8 @@ console.log('[URL] ASSET_ID', ASSET_ID, '| ACCOUNT_ID', ACCOUNT_ID, '| callId', console.log('🟩 config', config) -let socket, hub +let socket, hub, having +let doIHaveAudio = false setTimeout(() => { hub = io(config.hubAddress) @@ -191,20 +192,22 @@ const getLocalStream = () => { }) navigator.permissions.query( - // { name: 'camera' } { name: 'microphone' } - // { name: 'geolocation' } - // { name: 'notifications' } - // { name: 'midi', sysex: false } - // { name: 'midi', sysex: true } - // { name: 'push', userVisibleOnly: true } - // { name: 'push' } // without userVisibleOnly isn't supported in chrome M45, yet - ).then(function(permissionStatus){ + ).then(function(permissionStatus) { + + console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt - console.log(permissionStatus.state); // granted, denied, prompt + // If he has entered before, the saved access is already saved + if (permissionStatus === 'grated') { + doIHaveAudio = true; + } - permissionStatus.onchange = function(){ - console.log("Permission changed to " + this.state); + // If it is the first time client enter and give permission + permissionStatus.onchange = function() { + console.log('🟨 [PERMISSION] onchange', this.state); + if (this.state === 'grated') { + doIHaveAudio = true; + } } })