add comments

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent ba97ff3f5f
commit 220cd345f6

@ -89,7 +89,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R
// MARK: Audio Source
var hasAlternateAudioSources: Bool {
Logger.info("\(TAG) available audio routes count: \(allAudioSources.count)")
Logger.info("\(TAG) available audio sources: \(allAudioSources)")
// internal mic and speakerphone will be the first two, any more than one indicates e.g. an attached bluetooth device.
// TODO is this sufficient? Are their devices w/ bluetooth but no external speaker? e.g. ipod?

@ -182,13 +182,18 @@ struct AudioSource: Hashable {
setAudioSession(category: AVAudioSessionCategorySoloAmbient,
mode: AVAudioSessionModeDefault)
} else if call.hasLocalVideo {
// Don't allow bluetooth for local video if speakerphone has been explicitly chosen by the user.
let options: AVAudioSessionCategoryOptions = call.isSpeakerphoneEnabled ? [.defaultToSpeaker] : [.defaultToSpeaker, .allowBluetooth]
// Apple Docs say that setting mode to AVAudioSessionModeVideoChat has the
// side effect of setting options: .allowBluetooth, when I remove the (seemingly unnecessary)
// option, and inspect AVAudioSession.sharedInstance.categoryOptions == 0. And availableInputs
// does not include my linked bluetooth device
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
mode: AVAudioSessionModeVideoChat,
options: options)
options: [.allowBluetooth])
} else {
// Apple Docs say that setting mode to AVAudioSessionModeVoiceChat has the
// side effect of setting options: .allowBluetooth, when I remove the (seemingly unnecessary)
// option, and inspect AVAudioSession.sharedInstance.categoryOptions == 0. And availableInputs
// does not include my linked bluetooth device
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord,
mode: AVAudioSessionModeVoiceChat,
options: [.allowBluetooth])

Loading…
Cancel
Save