Closed benjaminhouy closed 2 years ago
Thank you for reporting this. It is a bug, there's an internal isPlaying
flag that's not reset after you call setSource
. I don't think the flag is actually needed. I'll do some tests and post a fix soon.
Perfect, thank you.
I didn't realize there was a paused property for the HTML audio element. I switched to that and it works :)
togglePlay() {
this.audioElement.paused ? instance.player.play() : instance.player.pause();
}
Excellent, thanks!
v0.28.1 is now available in npm with this fix.
Thanks for the quick fix! :)
Hi,
I load the following code on page load:
Then I have a button users can click to load a different audio file. It triggers this function:
Finally, I have a play pause button linked to the following function:
The issue I have is that if a user starts playing the audio and then clicks on the loadNormal() button, the audio pauses but instance.player.isPlaying() still returns true even if I then fire instance.player.pause().
One workaround I have found is adding this at the end of loadNormal which then makes instance.player.isPlaying() return false as expected:
I'm not quite sure whether this is a bug and the pause event doesn't get emitted properly when using setSource or whether I'm using setSource wrong.
Thanks