fixed bug: If recording is paused before restarting it will cause the "Recording paused" not to be edited
This commit is contained in:
parent
838364b6f1
commit
8cd2372f53
2 changed files with 9 additions and 8 deletions
|
@ -60,16 +60,17 @@ function startOrResumeRec() {
|
||||||
timer.resume();
|
timer.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
function restartRec() {
|
async function restartRec() {
|
||||||
// TODO: BUG: If recording is paused before restarting
|
// TODO: BUG: If recording is paused before restarting
|
||||||
// it will cause the "Recording paused" not to be edited
|
// 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;
|
_mediaRecorder = null;
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
init()
|
await init();
|
||||||
.then(startOrResumeRec);
|
startOrResumeRec();
|
||||||
}
|
}
|
||||||
|
|
||||||
function VoiceMailRecorder({ fnHowToSubmit }) {
|
function VoiceMailRecorder({ fnHowToSubmit }) {
|
||||||
|
@ -109,7 +110,6 @@ function VoiceMailRecorder({ fnHowToSubmit }) {
|
||||||
|
|
||||||
const audioFile = new File([audioBlob], 'voicemail.webm', opts);
|
const audioFile = new File([audioBlob], 'voicemail.webm', opts);
|
||||||
fnHowToSubmit(audioFile);
|
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
|
}, 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')
|
{(_mediaRecorder && _mediaRecorder.state === 'recording')
|
||||||
? (<IconButton onClick={pauseRec} src={PauseIC}>Pause</IconButton>)
|
? (<IconButton onClick={pauseRec} src={PauseIC}>Pause</IconButton>)
|
||||||
: (<IconButton onClick={startOrResumeRec} src={PlayIC}>Start</IconButton>)}
|
: (<IconButton onClick={startOrResumeRec} src={PlayIC}>Start</IconButton>)}
|
||||||
<IconButton onClick={restartRec} src={ArrowIC} tooltip="Start over">Reset</IconButton>
|
<IconButton onClick={() => restartRec().then(() => setState('Recording...'))} src={ArrowIC} tooltip="Start over">
|
||||||
|
Reset
|
||||||
|
</IconButton>
|
||||||
<IconButton onClick={() => stopAndSubmit()} src={ChevronBottomIC} tooltip="Add as attachment" type="submit">Submit</IconButton>
|
<IconButton onClick={() => stopAndSubmit()} src={ChevronBottomIC} tooltip="Add as attachment" type="submit">Submit</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -180,7 +180,6 @@ function RoomViewInput({
|
||||||
if (msgBody.trim() === '' && attachmentOrUi === null) return;
|
if (msgBody.trim() === '' && attachmentOrUi === null) return;
|
||||||
sendIsTyping(false);
|
sendIsTyping(false);
|
||||||
|
|
||||||
// TODO: Notify user about their mistake
|
|
||||||
if (typeof attachmentOrUi === 'string') return; // Attachment UI is not finished
|
if (typeof attachmentOrUi === 'string') return; // Attachment UI is not finished
|
||||||
roomsInput.setMessage(roomId, msgBody);
|
roomsInput.setMessage(roomId, msgBody);
|
||||||
if (attachmentOrUi !== null && typeof attachmentOrUi === 'object') {
|
if (attachmentOrUi !== null && typeof attachmentOrUi === 'object') {
|
||||||
|
|
Loading…
Reference in a new issue