I donβt think there is, and you probably donβt need to access the API directly to determine if the device is disconnected or not. What you need to know is:
When playing a sound, you will do something like:
try AVAudioSession.sharedInstance().setCategory({AVAudioSessionCategory}) try AVAudioSession.sharedInstance().setActive(true) audioPlayer = try AVAudioPlayer(contentsOfURL: alertSound) audioPlayer.prepareToPlay() audioPlayer.play()
In {AVAudioSessionCategory} you can specify:
AVAudioSessionCategorySoloAmient: your sound is muted by screen lock and using the Silent switch
AVAudioSessionCategoryPlayBack: your audio continues using the Silent switch turned off or when the screen is locked
source share