Only stop recording if we have collected some samples.

On slow machines it was possible to double click record before the chunk of samples had been processed, causing zero-length audio buffers
This commit is contained in:
Paul Kaplan committed 2019-01-14 12:20:20 -05:00
1 parent f3c15c402f
commit 3f51775f07
1 file changed
+3 -1
+3 -1
View File
@@ -43,7 +43,9 @@ class RecordModal extends React.Component {
this.setState({recording: true});
}
handleStopRecording (samples, sampleRate, levels, trimStart, trimEnd) {
this.setState({samples, sampleRate, levels, trimStart, trimEnd, recording: false});
if (samples.length > 0) {
this.setState({samples, sampleRate, levels, trimStart, trimEnd, recording: false});
}
}
handlePlay () {
this.setState({playing: true});