I would liked to detect whether or not microphone permissions have been granted on my site when it loads without actually running something like the following:
n
navigator.getUserMedia
is now obsolete, replaced by MediaDevices.getUserMedia
, which returns a promise. If the promise gets rejected you get an DOMException with indication of the problem. Insufficient permissions is one of the options there.
Details here: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia