Override or Detect iOS Mute

Roger that.  I wan’t thinking about that for the mute switch.  I hope someone else has some insight on this.

Meanwhile, this might make a a good feature request.

I’d love to see more visibility and control over the iOS settings and statuses like whether GPS is enabled, whether the mute switch is toggled, etc. 

Let me add to this. Apple explicitly states in their Human Interface Guidelines: 

Silence. People switch their device to silent to avoid being interrupted by unexpected sounds, such as ringtones and incoming message sounds. They also want nonessential sounds disabled, including keyboard sounds, sound effects, game soundtracks, and other audible feedback. When the device is set to silent, only explicitly initiated sounds should occur, such as audio during media playback, alarms, and audio/video messaging.”

https://developer.apple.com/ios/human-interface-guidelines/interaction/audio/

Rob

Yes Rob and that’s what I’ve heard from Corona for a couple years, however even Apple developer support suggest overriding the mute switch if customers are complaining.  There is a discussion going on Developer Exchange on Facebook and every developer there overrides or detects if the mute is on.

Surely there is some way Corona could detect if the device is muted?

Rob, another point is that “explicitly initiated sounds should occur”.  My games use voice instructions and the game is unusable without them, so I’d argue that it’s an essential sound.  I’m sure that’s how many apps are justifying this to Apple.  It’s not that I’m playing random sounds, it’s that they are essential the the app and are explicity initiated.

I’ll file a feature request for this, hopefully it can get addressed.

It seems this is already a feature request, so I’m just going to bump it.  This has become the highest priority features for us:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/5881574-ability-to-check-if-device-mute-button-is-on-and-a

Hey guys,

You can force audio to play by ignoring the mute switch with this code:

if audio.supportsSessionProperty == true then audio.setSessionProperty(audio.MixMode, audio.MediaPlaybackMixMode) end 

DISCLAIMER:

Please be aware that setSessionProperty() and its settings are private APIs and completely unsupported.

It may or may not work in future versions of iOS or Corona. If you decide to use it, you do so at your own risk.

Oh interesting, thanks ingemar_cl.  I’ll have to give this a try soon.

I see MediaPlaybackMixMode corresponds to Apple’s k​Audio​Session​Category_Media​Playback.  As they describe, “For playing recorded music or other sounds that are central to the successful use of your app”.  Sounds promising!

So I mentioned this request to Scott Harrison, who has put several plugins of this type in the marketplace and he tells me he’s close to having it ready to go in an update to his “More Info” plugin. He’s done a ton for the community and is not getting rich for his efforts (though he should). I’d encourage you to not wait for him to update his plugin before you buy it (and all his plugins), as a show of good faith. Dude’s a superstar. Here’s a link to the plugin: https://marketplace.coronalabs.com/plugin/more-info

Sharing a screenshot by Scott showing the data his updated plugin will give you access to. Note the “isMuted” and “isHeadsetPluggedIn” entries. Seriously, throw the guy $5, and do it today to encourage him to keep it up. In under a week he’s fixed an isssue many of us have griped about for years.

@scroederapps

I agree. For 5 years this issue have caused a lot of bad reviews on one of the apps I did.

Looking forward to not having to tell customers that they should un-mute their devices.

Thanks Scott

This should be added to more info( I need to test this for sure when I get home)

https://marketplace.coronalabs.com/plugin/more-info

https://scotth.tech/plugin-moreInfo

Thanks for the shout out Jason.

Btw you should wait at least 2 seconds before you check mute switch.

I will do official announcement in little bit

Just chiming in on this old(ish) thread to give another big round of props to Scott for the enhancement to his plugin! I am preparing an update for a kids app that was plagued by the occasional “hey this app has no sound” bad review and hopefully this will put an end to those. I’m able to throw up a native alert if the app launches muted, and put in a little red text notification on the homescreen that toggles on and off with the mute switch (see below). So helpful! Thanks Scott!

Guess I’m chiming in late. Agreed that if an app depends on audio while I’m using it, then the mute thing can be a problem. But if any app started playing a sound while I had my phone muted during a time when I explicitly did not want to hear sounds (dinner, sleep, meeting), that would be an instant 1-star review with a big long complaint following it.

Again, if you want to visually alert people about the mute switch being on, that’s great and Scott’s plugin can address that. But any other override would be borderline abuse: if I mute my TV, then it’s muted… just because an advertisement wants me to hear about whatever drivel they’re selling doesn’t mean the audio just should just un-mute on me. Just saying. :slight_smile:

Brent

@brent: agreed. I’m not looking to make unintended noise - just to prevent user anger (and bad reviews) over missing *intended* noise. :laughing: (I also included a “don’t remind me about this again” option - I don’t like being a nag.)

I’m still unaware of any way to actually override the mute switch. But Scott’s plugin really helps to give users the info to help themselves before they fire off an angry 1-star review. :smiley:

I honestly hate the mute button at times. Because for example, I am playing geometry dash, I turn up the volume, and nothing happens. So I check the settings within the app to see if it is off and then i check my audio source in control panel(slide up panel). I then realize it is my mute switch. It is so easy to forget about. While it is convenient to have a mute button, it is easy to forget. I have a question, how many companies can you name that still use the mute switch besides apple.