startupartist
11/20/2024, 1:26 PMVapi
11/20/2024, 1:29 PMVapi
11/20/2024, 1:29 PMoverrideOutputAudioPort parameter from .none to .speaker. This might seem counterintuitive, but .speaker in this context refers to the default audio route, which is the receiver for a .playAndRecord category with .voiceChat mode.
Here's how you can modify your configureAudioSession function:
swift
private func configureAudioSession() {
do {
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playAndRecord,
mode: .voiceChat,
options: [.allowBluetooth, .allowBluetoothA2DP])
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
try audioSession.overrideOutputAudioPort(.speaker) // Change this line
} catch {
print("Failed to configure audio session: \(error)")
}
}
Give this a try, and it should direct the audio output to the receiver when no other audio route like Bluetooth headphones is active. If you continue to experience issues or have any more questions, feel free to ask!Vapi
11/20/2024, 1:29 PMstartupartist
11/20/2024, 1:35 PMShubham Bajaj
11/22/2024, 8:19 AMstartupartist
11/25/2024, 8:04 PMShubham Bajaj
11/27/2024, 10:00 AMEthan Tan
01/20/2025, 2:44 PMEthan Tan
01/20/2025, 2:44 PMShubham Bajaj
01/20/2025, 3:29 PMEthan Tan
01/21/2025, 9:34 AMEthan Tan
01/23/2025, 9:15 AMEthan Tan
02/01/2025, 5:07 PMShubham Bajaj
02/03/2025, 4:21 PMEthan Tan
02/04/2025, 1:17 PMEthan Tan
02/13/2025, 11:41 AMSarthak
02/13/2025, 4:25 PMEthan Tan
04/03/2025, 11:15 AMSarthak
04/06/2025, 12:39 PMEthan Tan
04/08/2025, 10:27 PMSarthak
04/10/2025, 10:33 PMEthan Tan
04/10/2025, 10:34 PMEthan Tan
07/16/2025, 5:27 PMSarthak
07/16/2025, 11:46 PMSarthak
07/19/2025, 6:11 PM