mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix Bluetooth audio in calls.
// FREEBIE
This commit is contained in:
parent
de1332479c
commit
7e18052c45
|
@ -98,14 +98,15 @@ import AVFoundation
|
|||
if call.hasLocalVideo {
|
||||
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
|
||||
mode: AVAudioSessionModeVideoChat,
|
||||
options: .defaultToSpeaker)
|
||||
options: [.defaultToSpeaker])
|
||||
} else if call.isSpeakerphoneEnabled {
|
||||
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
|
||||
mode: AVAudioSessionModeVoiceChat,
|
||||
options: .defaultToSpeaker)
|
||||
options: [.defaultToSpeaker])
|
||||
} else {
|
||||
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
|
||||
mode: AVAudioSessionModeVoiceChat)
|
||||
mode: AVAudioSessionModeVoiceChat,
|
||||
options: [.allowBluetooth])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +151,7 @@ import AVFoundation
|
|||
} else {
|
||||
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
|
||||
mode: AVAudioSessionModeVoiceChat,
|
||||
options: .mixWithOthers)
|
||||
options: [.mixWithOthers, .allowBluetooth])
|
||||
}
|
||||
|
||||
// HACK: Without this async, dialing sound only plays once. I don't really understand why. Does the audioSession
|
||||
|
@ -299,6 +300,8 @@ import AVFoundation
|
|||
private func setAudioSession(category: String,
|
||||
mode: String? = nil,
|
||||
options: AVAudioSessionCategoryOptions = AVAudioSessionCategoryOptions(rawValue: 0)) {
|
||||
assert(Thread.isMainThread)
|
||||
|
||||
do {
|
||||
if #available(iOS 10.0, *), let mode = mode {
|
||||
try AVAudioSession.sharedInstance().setCategory(category, mode: mode, options: options)
|
||||
|
|
Loading…
Reference in a new issue