From f5587ce0c968170e8493ee9effd88714392258e3 Mon Sep 17 00:00:00 2001 From: N-Pex Date: Tue, 23 Mar 2021 12:40:06 +0100 Subject: [PATCH] Better error message for no mic permission Also, change back bit rate to 128, see if it affects things. --- src/components/VoiceRecorder.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/VoiceRecorder.vue b/src/components/VoiceRecorder.vue index 92bbfb4..66e1289 100644 --- a/src/components/VoiceRecorder.vue +++ b/src/components/VoiceRecorder.vue @@ -111,7 +111,7 @@ -
Failed to record audio
+
{{ errorMessage || 'Failed to record audio' }}
@@ -179,6 +179,7 @@ export default { recordTimer: null, recordingLocked: false, recordedFile: null, + errorMessage: null }; }, watch: { @@ -217,6 +218,7 @@ export default { if (val) { // Add listeners this.state = State.INITIAL; + this.errorMessage = null; this.recordedFile = null; if (this.ptt) { document.addEventListener("mouseup", this.mouseUp, false); @@ -315,7 +317,7 @@ export default { const MicRecorder = require("mic-recorder-to-mp3"); // Start recording. Browser will request permission to use your microphone. this.recorder = new MicRecorder({ - bitRate: 32, + bitRate: 128, }); this.recorder .start() @@ -326,6 +328,9 @@ export default { }) .catch((e) => { console.error(e); + if (e && e.name == "NotAllowedError") { + this.errorMessage = e.message; + } this.state = State.ERROR; }); },