diff --git a/src/app/organisms/room/AttachmentUis/VoiceMailRecorder.jsx b/src/app/organisms/room/AttachmentUis/VoiceMailRecorder.jsx
index 5f98ff51..dd0cedf0 100644
--- a/src/app/organisms/room/AttachmentUis/VoiceMailRecorder.jsx
+++ b/src/app/organisms/room/AttachmentUis/VoiceMailRecorder.jsx
@@ -60,16 +60,17 @@ function startOrResumeRec() {
timer.resume();
}
-function restartRec() {
+async function restartRec() {
// TODO: BUG: If recording is paused before restarting
// it will cause the "Recording paused" not to be edited
- if (_mediaRecorder.state !== 'recording') _mediaRecorder.pause();
- if (_mediaRecorder.state !== 'inactive') _mediaRecorder.stop();
+ // Needed, otherwise the browser indicator would remain after closing UI
+ if (_mediaRecorder.state !== 'inactive') _mediaRecorder.stop();
+ _stream.getTracks().forEach((track) => track.stop());
_mediaRecorder = null;
timer = new Timer();
- init()
- .then(startOrResumeRec);
+ await init();
+ startOrResumeRec();
}
function VoiceMailRecorder({ fnHowToSubmit }) {
@@ -109,7 +110,6 @@ function VoiceMailRecorder({ fnHowToSubmit }) {
const audioFile = new File([audioBlob], 'voicemail.webm', opts);
fnHowToSubmit(audioFile);
- // BUG: This will cause the recorder to add the file although it was to be cancelled
}, 300); // TODO: Fix this hack, stop does not mean dataavailable but its going to happen soon
}
}
@@ -151,7 +151,9 @@ function VoiceMailRecorder({ fnHowToSubmit }) {
{(_mediaRecorder && _mediaRecorder.state === 'recording')
? (Pause)
: (Start)}
- Reset
+ restartRec().then(() => setState('Recording...'))} src={ArrowIC} tooltip="Start over">
+ Reset
+
stopAndSubmit()} src={ChevronBottomIC} tooltip="Add as attachment" type="submit">Submit
diff --git a/src/app/organisms/room/RoomViewInput.jsx b/src/app/organisms/room/RoomViewInput.jsx
index f37e9def..4d1d2f7e 100644
--- a/src/app/organisms/room/RoomViewInput.jsx
+++ b/src/app/organisms/room/RoomViewInput.jsx
@@ -180,7 +180,6 @@ function RoomViewInput({
if (msgBody.trim() === '' && attachmentOrUi === null) return;
sendIsTyping(false);
- // TODO: Notify user about their mistake
if (typeof attachmentOrUi === 'string') return; // Attachment UI is not finished
roomsInput.setMessage(roomId, msgBody);
if (attachmentOrUi !== null && typeof attachmentOrUi === 'object') {