Encountered a strange issue in my game and was able to easily reproduce it in a new project. If I have audio playing but MediaPlayer.IsMuted is set to true, then hit the power button on my phone (or emulator) to pause, then hit it again to bring it back, MediaPlayer.IsMuted gets set to false and audio can be heard.
I’ve logged this as an issue here:
I thought I would be able to work around this by trapping the Android OnPause and OnResume/OnPostResume events to save and restore state; however, it looks like sometimes the resume event gets fired too early and MediaPlayer automatically sets itself to unmuted again. The best I’ve been able to do is stick a conditional in my Update method that constantly ensures that MediaPlayer.IsMuted is equal to my stored value and, if it is not, sets it. This leads to hearing a blip of audio when MonoGame unmutes it but before the Update can set things right.
I know there’s folks around here who are working on, and have released titles… has anybody encountered this before? If so, is there a better way to work around it?