@@ -93,32 +93,48 @@ export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent<C
9393 * Start recording.
9494 */
9595 async startRecording ( ) : Promise < void > {
96- const media = await this . createMedia ( ) ;
96+ try {
97+ const media = await this . createMedia ( ) ;
9798
98- this . media$ . next ( media ) ;
99+ this . media$ . next ( media ) ;
99100
100- media . recorder . start ( ) ;
101+ media . recorder . start ( ) ;
102+ } catch ( error ) {
103+ CoreDomUtils . showErrorModal ( error ) ;
104+ }
101105 }
102106
103107 /**
104108 * Stop recording.
105109 */
106110 stopRecording ( ) : void {
107- this . media$ . value ?. recorder . stop ( ) ;
111+ try {
112+ this . media$ . value ?. recorder . stop ( ) ;
113+ } catch ( error ) {
114+ CoreDomUtils . showErrorModal ( error ) ;
115+ }
108116 }
109117
110118 /**
111119 * Stop recording.
112120 */
113121 pauseRecording ( ) : void {
114- this . media$ . value ?. recorder . pause ( ) ;
122+ try {
123+ this . media$ . value ?. recorder . pause ( ) ;
124+ } catch ( error ) {
125+ CoreDomUtils . showErrorModal ( error ) ;
126+ }
115127 }
116128
117129 /**
118130 * Stop recording.
119131 */
120132 resumeRecording ( ) : void {
121- this . media$ . value ?. recorder . resume ( ) ;
133+ try {
134+ this . media$ . value ?. recorder . resume ( ) ;
135+ } catch ( error ) {
136+ CoreDomUtils . showErrorModal ( error ) ;
137+ }
122138 }
123139
124140 /**
@@ -143,15 +159,19 @@ export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent<C
143159 return ;
144160 }
145161
146- const fileName = await CoreFile . getUniqueNameInFolder ( CoreFileProvider . TMPFOLDER , 'recording.mp3' ) ;
147- const filePath = CorePath . concatenatePaths ( CoreFileProvider . TMPFOLDER , fileName ) ;
148- const fileEntry = await CoreFile . writeFile ( filePath , this . recording . blob ) ;
162+ try {
163+ const fileName = await CoreFile . getUniqueNameInFolder ( CoreFileProvider . TMPFOLDER , 'recording.mp3' ) ;
164+ const filePath = CorePath . concatenatePaths ( CoreFileProvider . TMPFOLDER , fileName ) ;
165+ const fileEntry = await CoreFile . writeFile ( filePath , this . recording . blob ) ;
149166
150- this . close ( {
151- name : fileEntry . name ,
152- fullPath : fileEntry . toURL ( ) ,
153- type : 'audio/mpeg' ,
154- } ) ;
167+ this . close ( {
168+ name : fileEntry . name ,
169+ fullPath : fileEntry . toURL ( ) ,
170+ type : 'audio/mpeg' ,
171+ } ) ;
172+ } catch ( error ) {
173+ CoreDomUtils . showErrorModal ( error ) ;
174+ }
155175 }
156176
157177 /**
0 commit comments