Playing Audio in the Background using Flutter
Solution 1
Just activate in : Signing&Capabilities /-----> +Capabilities -------> BackgroundModes : Audio, AirPlay,Picture in Picture
if your player streams music from a server also enable background fetch
Image of Capabilities in XCode
look at the picture above:
Solution 2
There are some flutter packages that play audio in the background and they are controlled on the lock screen.
Solution 3
You can use flutter package to implement background audio play as well as lock controls. https://pub.dev/packages/flutter_playout
Check this. Hope it helps.
Greg
Updated on December 20, 2022Comments
-
Greg over 1 year
We have created an app using the flutter platform, music plays fine, but we are struggling to get the app to play audio in the background on iOS devices, soon as you move to another app or lock your phone the music stops.
Does anyone have any tips?
-
Bilaal Abdel Hassan almost 4 yearsIt works well on android?
-
Greg almost 4 yearsYes seems to work fine on android
-
Bilaal Abdel Hassan almost 4 yearsCan you try this? stackoverflow.com/questions/54646498/…
-