londonappbrewery / xylophone-flutter

Starter code for the Xylophone project in the Complete Flutter Bootcamp
https://www.appbrewery.co
115 stars 893 forks source link

the sounds stops playing after a few seconds #20

Closed gaurav1903 closed 3 years ago

gaurav1903 commented 4 years ago

after I play with the buttons and quickly press them a few times. all the buttons completely stop working. My code was the same as ms angela. I had to earlier move my project into new android embedding.

MdRubayat commented 4 years ago

I'm facing the exact same issue here . After few clicks the buttons stops working, does anyone have any solutions for this .

ArchangelAmin commented 4 years ago

same issue here, I have run the app multiple times and counted and after about 31 button presses the app stops working.

akhil-muralidharan commented 4 years ago

[SOLUTION]

modify playSound() function as below.

void playSound(int note) async { final player = AudioCache(); var bytes = await (await player.load('note$note.wav')).readAsBytes(); player.playBytes(bytes); }

gaurav1903 commented 3 years ago

thanks bro. But do you have any idea, why this happens??

ArchangelAmin commented 3 years ago

[SOLUTION]

modify playSound() function as below.

void playSound(int note) async { final player = AudioCache(); var bytes = await (await player.load('note$note.wav')).readAsBytes(); player.playBytes(bytes); }

thanks. I'm not a programmer and I don't know why and how it works, but it works!

ArchangelAmin commented 3 years ago

thanks bro. But do you have any idea, why this happens??

https://github.com/luanpotter/audioplayers/issues/682#issuecomment-737195863

here is a short explanation from a collaborator on the project. hope this helps.