alert when microphone has no permission

dependencies hashes:
openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501
ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3
ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239
ofxVariableLab 8df98846248a93aa068989a3ebd0d2f0f16e5e69
ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8
theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18
This commit is contained in:
themancalledjakob 2024-03-22 18:16:04 +01:00
parent ede5b5d44c
commit 4ef2ee4670

View file

@ -44,6 +44,7 @@ const Audio = function(tp, record) {
//}, //},
//}); //});
let started = false; let started = false;
let allowedMicrophone = true; // TODO: actually use this
let mapping = {}; let mapping = {};
let savedMapping = {}; let savedMapping = {};
@ -915,7 +916,15 @@ const Audio = function(tp, record) {
visualize(); visualize();
}) })
.catch(function(err) { .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 { } else {
console.log("getUserMedia not supported on your browser!"); console.log("getUserMedia not supported on your browser!");