Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/AudioRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class AudioRecorder extends React.Component<AudioRecorderProps, A
};

static defaultProps = {
reset: false,
startRecording: false,
loop: false,
downloadable: true,
Expand Down Expand Up @@ -80,7 +81,7 @@ export default class AudioRecorder extends React.Component<AudioRecorderProps, A
}

componentDidUpdate() {
{ this.props.startRecording ? this.startRecording() : undefined }
{ this.props.startRecording && !this.state.isRecording ? this.startRecording() : undefined }
{ this.props.reset ? this.onRemoveClick() : undefined }
}

Expand Down Expand Up @@ -171,14 +172,14 @@ export default class AudioRecorder extends React.Component<AudioRecorderProps, A
[
'AudioRecorder-button',
this.state.audioData ? 'hasAudio' : '',
this.state.isPlaying ? 'isPlaying' : '',
// this.state.isPlaying ? 'isPlaying' : '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented out code

this.state.isRecording ? 'isRecording' : '',
].join(' ')
}
onClick={this.onButtonClick}
>
{this.state.audioData && !this.state.isPlaying && this.props.playLabel}
{this.state.audioData && this.state.isPlaying && this.props.playingLabel}
{/* {this.state.audioData && this.state.isPlaying && this.props.playingLabel} */}
{!this.state.audioData && !this.state.isRecording && this.props.recordLabel}
{!this.state.audioData && this.state.isRecording && this.props.recordingLabel}
</button>
Expand Down