Hi, I’m working on an app that contains a feed of videos. The app has a global mute state flag that can be enabled or disabled. When the app mute state is toggled, I toggle the isMuted flag on my AVPlayers, and I also toggle the AVAudioSession category between .ambient and .playback.
I enable/disable the mute state when the user taps a software button in my app. I also enable/disable the mute state when the user toggles the iPhone physical mute switch. This behavior is extremely similar to how mute state works in the Instagram app.
However, my physical mute switch detection mechanism is quite hacky/finicky. I’m using a framework called Mute that I found on Github: https://github.com/akramhussein/Mute. It generally works, but it is far from a perfect solution, in part because it mis-triggers if the app hangs for a second (especially on older devices).
How can I more reliably detect the state of the iPhone’s physical mute switch? It certainly must be possible, because mute switch detection in the Instagram app is much faster and more reliable than it is in my app.
In case it’s useful, I submitted Feedback about this back in January (https://feedbackassistant.apple.com/feedback/7545314), but have not yet heard back.
Thank you!
I enable/disable the mute state when the user taps a software button in my app. I also enable/disable the mute state when the user toggles the iPhone physical mute switch. This behavior is extremely similar to how mute state works in the Instagram app.
However, my physical mute switch detection mechanism is quite hacky/finicky. I’m using a framework called Mute that I found on Github: https://github.com/akramhussein/Mute. It generally works, but it is far from a perfect solution, in part because it mis-triggers if the app hangs for a second (especially on older devices).
How can I more reliably detect the state of the iPhone’s physical mute switch? It certainly must be possible, because mute switch detection in the Instagram app is much faster and more reliable than it is in my app.
In case it’s useful, I submitted Feedback about this back in January (https://feedbackassistant.apple.com/feedback/7545314), but have not yet heard back.
Thank you!