Hi all!
I have two apps that have been on the Apple and Google Play stores for a few years, developed here with Corona / Solar2D. The apps are “ACT Audio Proctor” and “SAT Audio Proctor”.
The entire purpose of the apps is to provide a timer for students to simulate an actual SAT or ACT proctoring of a test. So, the app needs to play audio to provide the proctor’s voice and background noise as desired.
As others have noted, the sound won’t play if the user has the device ringer/silent switch turned to “silent.” In other discussions, people have said that Apple doesn’t allow apps to make sounds when the switch is turned to “silent”, but that’s not true. I have many podcast and music apps on my iPhone that can play sound even when I have the phone switch on “silent”, so it’s certainly possible to do. The point is that the silent switch is supposed to suppress UNWANTED sounds, but any student using this app definitely wants the sound in the same way that someone opening a music app expects to hear sounds even when the ringer switch is set to silent.
I have tried both of the following unsupported API workarounds that I have seen suggested here:
audio.setSessionProperty( audio.OverrideMixWithOthers, audio.MediaPlaybackMixMode )
audio.setSessionProperty( audio.MixMode, audio.AmbientMixMode )
Neither of those allow music to be played while the switch is set to silent.
On the assumption that it’s impossible to currently accomplish what I’m trying to do with Solar2D, I purchased and installed Scott_Harrison’s “More Info” plugin, and tried to use the moreInfo.isMuted() listener function to find out whether the phone is muted and display a message telling the user to unmute their phone, but it seems to not be working.
Here’s the code I’m trying to use to do that:
==============
moreInfo.isMuted(function (e)
isMuted = e.muted
print("isMuted: "…tostring(e.muted))
end)
if isMuted then
myTextItems["buttonNoiseText"].text = "Please unmute your phone to hear the audio."
local mutedCheckTimer = timer.performWithDelay(5000, function()
moreInfo.isMuted(function (e)
isMuted = e.muted
end)
if isMuted==false then
myTextItems["buttonNoiseText"].text = "tap for background noise:"
timer.cancel(mutedCheckTimer)
end
end, -1)
end
==============
This code would change the “tap for background noise” text to an alert about the phone being muted, but it doesn’t work when deployed to iPhones.
So, my questions:
-
Is there currently any way in Solar2D to get sound to play even when the iPhone switch is set to silent?
-
Is my moreInfo code wrong? Is moreInfo still operating correctly with iOS 16? The last message I saw from Scott_Harrison was back in February 2022, when he confirmed it was working correctly at that point.
Thanks so much everyone for the help – these forums have been invaluable to me.
Best,
Bobby Hood