I am trying to use AVAudioSession
and AVAudioPlayer
to play a short sound in an app, but only when the silent mode is not on. Using the .ambient
category seems to be doing this as expected. But when I am using AirPods (or any other ear phones) it plays the sound anyway.
try AVAudioSession.sharedInstance().setCategory(.ambient)
Does anyone know how I can get it to respect the silent switch also when using ear phones?
I would expect a way to get the AVAudioSession
to respect the silent mode, also when using ear phones.