!
I’m having an issue with the audioplayers
package when using it with the Flutter Framework. I’m calling the play()
function multiple times a second, and after a certain amount of calls, the sound has a delay and then all the sounds play at once.
I tested the audioplayers
example from GitHub on my iPhone and the same issue occurs when repeatedly clicking the button as fast as possible.
Is there a way to stop the previous sound before playing the next one, or is there another idea to deal with this issue?
This is my current implementation:
AudioCache upgradeSound = new AudioCache();
void playUpgradeSound() {
_playUpgradeSound(upgradeSound);
}
void _playUpgradeSound(AudioCache ac) async{
await ac.play('audio/upgr.mp3');
}
Thank you for your help!