stop recording on topic change

This commit is contained in:
or-else
2022-03-17 15:52:25 -07:00
parent c9391cf451
commit 891780bb52
7 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -79,6 +79,7 @@ export default class AudioRecorder extends React.PureComponent {
}
componentWillUnmount() {
this.startedOn = null;
if (this.stream) {
this.cleanUp();
}
@@ -114,9 +115,9 @@ export default class AudioRecorder extends React.PureComponent {
// Check if record is too long.
if (duration > MAX_DURATION) {
this.startedOn = null;
this.mediaRecorder.pause();
this.durationMillis += Date.now() - this.startedOn;
this.startedOn = null;
this.setState({enabled: false, recording: false, duration: secondsToTime(this.durationMillis / 1000)});
}