How to keep the audio playing when Android screen is locked?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ziher4
:warning: Old Version Published before Godot 3 was released.

Hi,

I’m using Godot for maybe a month now, still learning stuff. This is my first question.

So I’m building an app that’s focused on playing different sounds from the SamplePlayer, changing their volumes, muting/unmuting them and so on. What is essential for the app is for sound to be able to play even while Android screen is locked.

I couldn’t find how to do this, I’ve tried in project settings, SamplePlayer node inspector and tried from the code but was unable to do it. Any help appreciated! :slight_smile:

Are you thinking of having the sound for a long time running even with the screen locked ? i am not sure Godot has this ability natively, IMHO you will have to do some decent hack for it to work and it wont be portable (ios, windows…)

GameVisitor | 2017-09-24 13:13

Yes, the sound is looping in SamplePlayer so it would play for a long time. I don’t need it portable, only on Android export.
I read it can be done with Android service but I’m not sure how to implement/override that in Godot :frowning:

ziher4 | 2017-09-24 13:15

Bro, did you found a way? :"(

X | 2022-01-02 22:38