4

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. As soon as the user moves to another app or locks their phone, the music stops.

Does anyone have any tips on how to keep apps alive, running in the background, and playing audio even while the app does not have user focus?

skybondsor
  • 747
  • 10
  • 21
Greg
  • 61
  • 1
  • 1
  • 2

3 Answers3

4

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:

3

There are some flutter packages that play audio in the background and they are controlled on the lock screen.

loyal
  • 231
  • 1
  • 9
2

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.