2

I have airpods connected to my device and I am trying to switch the audio to speaker. I am using the code below which works when nothing is attached, other bluetooth devices are connected and when headphones are plugged in but it doesn't when there are airpods connected.

 do {
       try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSession.PortOverride.speaker)
                } catch let error as NSError {
                    print("audioSession error turning on speaker: \(error.localizedDescription)")
                } 
user1079052
  • 3,803
  • 4
  • 30
  • 55
  • Might be relevant: https://stackoverflow.com/questions/53922387/unable-to-switch-to-speaker-output-when-bluetooth-headsets-are-connected – Dmitry Zhukov Jun 17 '19 at 08:40

0 Answers0