diff --git a/public/bundle.js b/public/bundle.js index 2f9f879..9081ae1 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20521,26 +20521,30 @@ const getLocalStream = () => { } }) .then((streamSuccess) => { - navigator.permissions.query( - { name: 'microphone' } - ).then(function(permissionStatus) { - - console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt - - // If he has entered before, the saved access is already saved - if (permissionStatus === 'grated') { - doIHaveAudio = true; - } - - // If it is the first time client enter and give permission - permissionStatus.onchange = function() { - console.log('🟨 [PERMISSION] onchange', this.state); - if (this.state === 'granted') { + try { + navigator.permissions.query( + { name: 'microphone' } + ).then(function(permissionStatus) { + + console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt + + // If he has entered before, the saved access is already saved + if (permissionStatus === 'grated') { doIHaveAudio = true; } - } - - }) + + // If it is the first time client enter and give permission + permissionStatus.onchange = function() { + console.log('🟨 [PERMISSION] onchange', this.state); + if (this.state === 'granted') { + doIHaveAudio = true; + } + } + + }) + } catch (error) { + console.log('eeeeee', error); + } return streamSuccess }) .catch(error => { diff --git a/public/index.js b/public/index.js index 0026d00..f2c84de 100644 --- a/public/index.js +++ b/public/index.js @@ -163,26 +163,30 @@ const getLocalStream = () => { } }) .then((streamSuccess) => { - navigator.permissions.query( - { name: 'microphone' } - ).then(function(permissionStatus) { - - console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt - - // If he has entered before, the saved access is already saved - if (permissionStatus === 'grated') { - doIHaveAudio = true; - } - - // If it is the first time client enter and give permission - permissionStatus.onchange = function() { - console.log('🟨 [PERMISSION] onchange', this.state); - if (this.state === 'granted') { + try { + navigator.permissions.query( + { name: 'microphone' } + ).then(function(permissionStatus) { + + console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt + + // If he has entered before, the saved access is already saved + if (permissionStatus === 'grated') { doIHaveAudio = true; } - } - - }) + + // If it is the first time client enter and give permission + permissionStatus.onchange = function() { + console.log('🟨 [PERMISSION] onchange', this.state); + if (this.state === 'granted') { + doIHaveAudio = true; + } + } + + }) + } catch (error) { + console.log('eeeeee', error); + } return streamSuccess }) .catch(error => {