stop recording on topic change
This commit is contained in:
@@ -79,6 +79,7 @@ export default class AudioRecorder extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
this.startedOn = null;
|
||||||
if (this.stream) {
|
if (this.stream) {
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
}
|
}
|
||||||
@@ -114,9 +115,9 @@ export default class AudioRecorder extends React.PureComponent {
|
|||||||
|
|
||||||
// Check if record is too long.
|
// Check if record is too long.
|
||||||
if (duration > MAX_DURATION) {
|
if (duration > MAX_DURATION) {
|
||||||
|
this.startedOn = null;
|
||||||
this.mediaRecorder.pause();
|
this.mediaRecorder.pause();
|
||||||
this.durationMillis += Date.now() - this.startedOn;
|
this.durationMillis += Date.now() - this.startedOn;
|
||||||
this.startedOn = null;
|
|
||||||
this.setState({enabled: false, recording: false, duration: secondsToTime(this.durationMillis / 1000)});
|
this.setState({enabled: false, recording: false, duration: secondsToTime(this.durationMillis / 1000)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -10019,6 +10019,8 @@ class AudioRecorder extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
this.startedOn = null;
|
||||||
|
|
||||||
if (this.stream) {
|
if (this.stream) {
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
}
|
}
|
||||||
@@ -10049,9 +10051,9 @@ class AudioRecorder extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (duration > MAX_DURATION) {
|
if (duration > MAX_DURATION) {
|
||||||
|
this.startedOn = null;
|
||||||
this.mediaRecorder.pause();
|
this.mediaRecorder.pause();
|
||||||
this.durationMillis += Date.now() - this.startedOn;
|
this.durationMillis += Date.now() - this.startedOn;
|
||||||
this.startedOn = null;
|
|
||||||
this.setState({
|
this.setState({
|
||||||
enabled: false,
|
enabled: false,
|
||||||
recording: false,
|
recording: false,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user