Alexrr95
Alexrr95

Reputation: 81

Playing a background song in a flutter app

I'm developping a game in flutter - NOT a music player - so I was looking for a way to play a song in the background as soon as you start the game. I have only found packages built for music players - which might be really heavy - and not for the purpose of playing a single song.

Is there a way to do this without having to import one of these big libraries?

Upvotes: 2

Views: 2298

Answers (1)

Madhavam Shahi
Madhavam Shahi

Reputation: 1192

Umm..i have found this light package to make your work easier. https://pub.dev/packages/assets_audio_player

To play it when the app opens, create a function to play audio, and call it in the initState ()

Upvotes: 3

Related Questions