The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
(android)Modify Play Audio Mechanism
ancientli


Joined: 01 Jul 2015
Posts: 45
On android, play audio is by creating a new thread(SDL_RunAudio), once app go into background, the thread will be suspended, result in app can not play audio when background.

To support play audio when background, I modified the audio play mechanism, it uses Service(). By the way, add a hint(SDL_HINT_BACKGROUND_AUDIO) whether to allow the play audio when the background.

Source code on Github: https://github.com/freeors/SDL