let audioDevice = DefaultAudioDevice()
TwilioVideoSDK.audioDevice = audioDevice
audioDevice.block = {
DefaultAudioDevice.DefaultAVAudioSessionConfigurationBlock()
do {
let session = AVAudioSession.sharedInstance()
print("set audio session")
try session.setCategory(.playAndRecord, mode: .voiceChat)
try session.overrideOutputAudioPort(.none)
// tried adding the lines with an if-statement below as well as overriding the input above to `.none`
if isSpeaker {
try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
}
try session.setActive(true, options: .notifyOthersOnDeactivation)
} catch let error {
print("Error while configuring audio session: \(error)")
}
}
audioDevice.block()
}
Hello,
I'm having an issue switching off a speaker on a voice call using TwilioVideo (for an iOS application). As the audio routes default to the speaker, I am overriding it while configuring an audio session using the reference from the issues https://github.com/twilio/video-quickstart-ios/issues/307 and https://github.com/twilio/video-quickstart-ios/issues/379. However, using the following code does not seem to achieve the preferred result.
Thank you in advance for your help!