From 4ef2ee46708f93d95aeeb37204c2352d34d3ad08 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Fri, 22 Mar 2024 18:16:04 +0100 Subject: [PATCH] alert when microphone has no permission dependencies hashes: openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501 ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3 ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239 ofxVariableLab 8df98846248a93aa068989a3ebd0d2f0f16e5e69 ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8 theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18 --- bin/em/variabletime/web/js/audio.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/em/variabletime/web/js/audio.js b/bin/em/variabletime/web/js/audio.js index 77557e2..9c3b4f6 100644 --- a/bin/em/variabletime/web/js/audio.js +++ b/bin/em/variabletime/web/js/audio.js @@ -44,6 +44,7 @@ const Audio = function(tp, record) { //}, //}); let started = false; + let allowedMicrophone = true; // TODO: actually use this let mapping = {}; let savedMapping = {}; @@ -915,7 +916,15 @@ const Audio = function(tp, record) { visualize(); }) .catch(function(err) { - console.log("The following gUM error occured: " + err); + console.log("Audio::init","The following gUM error occured: " + err); + const noPermission = err.message.toLowerCase().indexOf('permission') >= 0; + if (noPermission) { + if (allowedMicrophone) { + alert("We don't have permission to access the microphone. Microphone input will be silent."); + } + allowedMicrophone = false; + // TODO: actually use this + } }); } else { console.log("getUserMedia not supported on your browser!");