You need to wrap your callbacks with arrow functions that call your methods directly (or call bind: this.sound.bind(this)
) so that it resolves to the correct this
scope:
<ReactAudioPlayer
src="{audio}"
onPlay={(ev) => this.sound(ev)}
onListen={(ev) => this.lis(ev)}
onSeeked={(ev) => this.seek(ev)}
controls></ReactAudioPlayer>
CLICK HERE to find out more related problems solutions.