Open ayushipaikane opened 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'));
It works... I also apply this... It's working...
the player.play bring error on my code
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?
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.
I am also facing same thing