glitchgrab 1.23.0 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -896,8 +896,9 @@ function ReportDialog({
896
896
  let stream = null;
897
897
  try {
898
898
  stream = await navigator.mediaDevices.getUserMedia({ audio: true });
899
- } catch (e) {
900
- if (!SpeechRec) {
899
+ } catch (err) {
900
+ const isDenied = err instanceof DOMException && (err.name === "NotAllowedError" || err.name === "PermissionDeniedError");
901
+ if (!SpeechRec || isDenied) {
901
902
  setVoiceError("Microphone access denied");
902
903
  return;
903
904
  }
@@ -974,7 +975,8 @@ function ReportDialog({
974
975
  };
975
976
  recognition.onerror = (event) => {
976
977
  if (event.error === "aborted" || event.error === "no-speech") return;
977
- setVoiceError("Speech recognition not available \u2014 try Chrome");
978
+ const isDenied = event.error === "not-allowed" || event.error === "audio-capture";
979
+ setVoiceError(isDenied ? "Microphone access denied" : "Speech recognition not available \u2014 try Chrome");
978
980
  usingWebSpeechRef.current = false;
979
981
  recognitionRef.current = null;
980
982
  setIsListening(false);