I want to use the audio players
package to run audio files
on my app,
NOTE:
- I use local files in
assets
file like this
assetsaudiohe_has_got_the_packa.mp3
this path file
I try to use AssetSource
// this is an object from AudioPlayer
AudioPlayer player = AudioPlayer();
...
TextButton(
onPressed: () {
player.setSource(AssetSource('assetsaudiohe_has_got_the_packa.mp3'));
},
child: Text('to play click here'),
),
but isn’t running because asynchronous suspension
I try searching but I don’t get content to this thing
2
Answers
you use below code and you issue is fix.
also please verify this image also.
Happy Codeing….
Try this
Adding
await
keyboard and makingonPressed()
async
is important.