Open dotpao opened 7 years ago
It seems it is not related to the multiple audios. Just loading, pausing and playing a single audio causes an issue. This is the updated fiddle https://jsfiddle.net/dotpao/njjgpa5h/6/
Ah! Thanks for the update - sorry I missed this in my latest round of work, I pushed a batch of updates for a 2-year-anniversary release just this weekend. 😉 I was able to repro this and it's a good one to fix, so I'll look into that; thanks for the detail.
Thanks to you.
And do you have an estimation when this issue will be solved?. Just to wait for it or apply a custom workaround at my side?
I haven't got a fix in for this one yet, sorry! I'll work this into the dev branch.
Perhaps the simplest fix is to not allow paused
to become true when playing
is false? That might be the safest route. I think it's a little odd to pause before playing, and so in that case (i.e., if the sound is not currently playing) it should just exit and not modify paused state.
Check this jsfiddle https://jsfiddle.net/dotpao/njjgpa5h/5/ from iOS Safari. I've noticed that when you try to load the same audio file twice and then pause the file before playing, the onfinish callback is never triggered. This happens only on iOS and it is related to the response received (readyState === 1)
In the pause method, s.paused gets true on iOS while on other browsers gets false. The difference is that on iOS readyState == 1 while on other browsers readyState == 3
Later in the play method, instanceCount would be increased, but this doesn't happen because it comes from a paused state (s.paused true), so it runs s.resume().
So the onfinish callback never triggers because instanceCount is zero.