When I was using SDL-2.0.5 and SDL_mixer 2.0.0, things worked well, but I needed some changes that were in a new version of the libraries, so I updated to SDL2-2.0.8 with SDL_mixer 2.0.2 with OGG support, and now the app hangs when it comes back into focus and resumes playing music. I was hoping to see if anyone had an idea of what I might be doing wrong before I file a bug report.
Everything builds fine using the NDK, and I can deploy to my Android device (Samsung Galaxy S7).
When I switch to a different app, my logs show that my event handler does handle SDL_APP_WILLENTERBACKGROUND by pausing the music using Mix_PauseMusic().
When I bring the app back up, my logs show that the event handler does handle SDL_APP_DIDENTERFOREGROUND, where I call Mix_ResumeMusic().
My logs show that once the call to Mix_ResumeMusic occurs, the app hangs (even switching apps again does not show any more logs going through the event handler) until Android says that the app is not responding and asks me to close it or wait.
Before I updated the library versions, I found that if I didn’t pause the music before the app entered the background, it would cause problems (I believe it crashed or would hang, but I don’t remember), but I am at a loss as to why resuming when the app is coming back into the foreground would cause an issue.
If I remove the call to Mix_ResumeMusic(), the app runs just fine, except there is a lack of music of course. Sound effects play just fine.
If I remove the call to Mix_PauseMusic(), the app hangs upon calling resume.
My investigation so far has pointed me to Mix_ResumeMusic() not working correctly on Android, but I wonder if there is something else I need to do perhaps to suspend or resume correctly? The only things I do are pause music and resume music, and maybe something else needs to be done, such as ensuring an open audio device or something like that?