Detect Mute/Ringer/Silence switch

Is there any consistent and stable way how to detect the Mute switch?

My game has states, where it advances to next state after an audio onComplete event. When the device is muted, I need to skip the audio.

Thanks, [import]uid: 10077 topic_id: 25817 reply_id: 325817[/import]

If the hardware mute switch is toggled, that doesn’t mean the player isn’t listening to audio. They could be using headphones.

That said, it is possible to get the state of the hardware volume using AudioSession properties. If you’re adventurous: http://developer.anscamobile.com/forum/2011/06/05/new-audiosession-properties

Even then it’s a one-check-is-all-you-get kind of deal. There’s no callback in Corona for hardware audio events so unless you’re checking the volume on a timer or something you’re not going to detect changes to the property.

I suggest you develop a visual cue to complement your audio cue, so whether the player’s listening or not there’s still a sense of Something Happening. [import]uid: 44647 topic_id: 25817 reply_id: 104449[/import]

Thanks for your reply! I forgot about using the headphones - good catch.

I might try the audio session properties again. I have already tried:

[lua]local master_ringer_volume = audio.getSessionProperty(1667788662)[/lua]

but it was always returning always the same value, regardless of my device volume setting. But this might be also due a bug in my code… [import]uid: 10077 topic_id: 25817 reply_id: 104583[/import]