react-howler icon indicating copy to clipboard operation
react-howler copied to clipboard

How to know when an audio is completed?

Open Illakkiya03 opened this issue 3 years ago • 1 comments

I tried using onEnd() and onStop() methods, but there was no alert during the end of the audio, instead I got an alert at the beginning of the audio. Thanks in advance!

Illakkiya03 avatar Jul 26 '21 06:07 Illakkiya03

Hi @Illakkiya03,

I'm not seeing this behavior. It's working as expected when I add the following to the FullControl example:

onStop logs message when I press the "Stop" button

<ReactHowler
  // ...
  onStop={() => console.log('onStop')}
  // ...

onEnd logs message when the sound playback is complete

  handleOnEnd () {
    console.log('handleOnEnd');
    this.setState({
      playing: false
    })
    this.clearRAF()
  }

Could you provide more details or a code example?

Thanks!

Stenerson avatar Jul 26 '21 13:07 Stenerson