londonappbrewery / xylophone-flutter

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

audioplayers package has been upgraded and the steps shown dont work anymore. not sure how to go about the project #51

Open ayushipaikane opened 1 year ago

paliwalaman7 commented 1 year ago

I am also facing same thing

sarmad-hzn commented 1 year ago

i just pasted the folder and added that in pubspec file (idk i should do it or not) and then this below code worked after reading the documentation

final player = AudioPlayer();
player.play(AssetSource('note1.wav'));
alizeeshan7447 commented 1 year ago

It works... I also apply this... It's working...

PiusCharles commented 9 months ago

the player.play bring error on my code

TriptiMirani commented 5 months ago

i just pasted the folder and added that in pubspec file (idk i should do it or not) and then this below code worked after reading the documentation

final player = AudioPlayer();
player.play(AssetSource('note1.wav'));

(i just pasted the folder and added that in pubspec file)==> which folder?

benkim3858 commented 1 month ago
final AudioPlayer player = AudioPlayer();

Future<void> playSound(String soundName) async {
await player.play(AssetSource(soundName));
}

After adding this code to Xylophone App Class

TextButton(
onPressed: () {
playSound('note1.wav');
},
child: Text('C'),
),

Use it like this on the button.