04-12-2013 08:47 AM
I'm using mmr to playback an mp3 file in my game, I had the game running and the screen locked before going to bed to check if I fixed a battery issue. When the game loses focus, it simply sets music volume to 0. Unfortunately, at 3am, I got an e-mail and noticed this issue. The problem is, receiving an e-mail played the sound effect and vibrated the phone, but it also triggered the volume of my music to be something other than zero. Touching the volume buttons(up or down) immediately silenced the music again and everything was back to normal.
Any idea why this would happen? Just in case it's relevant, I'm running 10.0.9.348.
04-19-2013 09:18 PM
Thanks for posting!
I tested out a very similar sample and was not able to preproduce this issue on 10.0.10 and I was not able to reproduce this. Please let us know if you still have this issue.
04-19-2013 10:03 PM
Thanks for trying to repro the case, I still haven't been able to upgrade to the latest OS, so that might be the difference. A simpler repro case i found is: in code, set the music volume to 0 then take a screenshot, that kicks the music back in(at the current system volume).
I fixed my previous issue by stopping the music when focus is lost and restarting it afterwards. I didn't go the extra mile and continue the music where it left off, I'll do that in the future. I'll also change it in the future to stop/start when I set the volume to zero/non-zero to avoid both the "screenshot" and "incoming email" issue(likely any system sound effect) while the app is running.
04-19-2013 10:18 PM
I just tried the screenshot too but I cant seem to reproduce the game music kicking in. I suppose it is fixed then
And yes! yes! the best practice we recommend would be to listen to the app lifecycle events and to put your music on a pause accordingly.