From 6d29a97e9de41614e25a2074fd86d0a8d63699b6 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 23 Feb 2023 12:46:06 +0100 Subject: [PATCH] MOBILE-2314 fileuploader: Catch errors in recorder --- .../audio-recorder.component.ts | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts index 184558e6b..d24111752 100644 --- a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts +++ b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts @@ -93,32 +93,48 @@ export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent { - const media = await this.createMedia(); + try { + const media = await this.createMedia(); - this.media$.next(media); + this.media$.next(media); - media.recorder.start(); + media.recorder.start(); + } catch (error) { + CoreDomUtils.showErrorModal(error); + } } /** * Stop recording. */ stopRecording(): void { - this.media$.value?.recorder.stop(); + try { + this.media$.value?.recorder.stop(); + } catch (error) { + CoreDomUtils.showErrorModal(error); + } } /** * Stop recording. */ pauseRecording(): void { - this.media$.value?.recorder.pause(); + try { + this.media$.value?.recorder.pause(); + } catch (error) { + CoreDomUtils.showErrorModal(error); + } } /** * Stop recording. */ resumeRecording(): void { - this.media$.value?.recorder.resume(); + try { + this.media$.value?.recorder.resume(); + } catch (error) { + CoreDomUtils.showErrorModal(error); + } } /** @@ -143,15 +159,19 @@ export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent