react-howler
react-howler copied to clipboard
How to know when an audio is completed?
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!
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!