Playing Audio in the Background using Flutter [closed]
Asked Answered
O

3

5

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?

Olson answered 8/5, 2020 at 22:8 Comment(3)
It works well on android?Counterpane
Yes seems to work fine on androidOlson
Can you try this? #54646998Counterpane
R
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:

Rarely answered 26/2, 2021 at 15:21 Comment(0)
S
4

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

Scheller answered 27/4, 2021 at 5:45 Comment(0)
B
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.

Brassy answered 8/5, 2020 at 22:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.