From 8515a8564917b9c0d0913ecb9b3d6e52e72153c2 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 20 May 2019 20:02:47 +0200 Subject: [PATCH] Added mic not allowed error --- web/js/voice/JavascriptRecorder.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/js/voice/JavascriptRecorder.ts b/web/js/voice/JavascriptRecorder.ts index cc334318..a53b7831 100644 --- a/web/js/voice/JavascriptRecorder.ts +++ b/web/js/voice/JavascriptRecorder.ts @@ -316,6 +316,14 @@ namespace audio { }, stream => resolve(stream), error => reject(error)); }); } catch(error) { + if(error instanceof DOMException) { + if(error.code == 0 || error.name == "NotAllowedError") { + console.warn(tr("Browser does not allow mirophone access")); + this._state = InputState.PAUSED; + createErrorModal(tr("Failed to create microphone"), tr("Microphone recording failed. Please allow TeaWeb access to your microphone")).open(); + return; + } + } console.warn(tr("Failed to initialize recording stream (%o)"), error); throw tr("record stream initialisation failed"); }