|
|
@ -106,19 +106,19 @@ public class OWSAudioSession: NSObject {
|
|
|
|
// session handling.
|
|
|
|
// session handling.
|
|
|
|
} else if aggregateBehaviors.contains(.playAndRecord) {
|
|
|
|
} else if aggregateBehaviors.contains(.playAndRecord) {
|
|
|
|
assert(avAudioSession.recordPermission == .granted)
|
|
|
|
assert(avAudioSession.recordPermission == .granted)
|
|
|
|
try avAudioSession.setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.record)))
|
|
|
|
try avAudioSession.setCategory(.record)
|
|
|
|
} else if aggregateBehaviors.contains(.audioMessagePlayback) {
|
|
|
|
} else if aggregateBehaviors.contains(.audioMessagePlayback) {
|
|
|
|
if self.device.proximityState {
|
|
|
|
if self.device.proximityState {
|
|
|
|
Logger.debug("proximityState: true")
|
|
|
|
Logger.debug("proximityState: true")
|
|
|
|
|
|
|
|
|
|
|
|
try avAudioSession.setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.playAndRecord)))
|
|
|
|
try avAudioSession.setCategory(.playAndRecord)
|
|
|
|
try avAudioSession.overrideOutputAudioPort(.none)
|
|
|
|
try avAudioSession.overrideOutputAudioPort(.none)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Logger.debug("proximityState: false")
|
|
|
|
Logger.debug("proximityState: false")
|
|
|
|
try avAudioSession.setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.playback)))
|
|
|
|
try avAudioSession.setCategory(.playback)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if aggregateBehaviors.contains(.playback) {
|
|
|
|
} else if aggregateBehaviors.contains(.playback) {
|
|
|
|
try avAudioSession.setCategory(AVAudioSession.Category(rawValue: convertFromAVAudioSessionCategory(AVAudioSession.Category.playback)))
|
|
|
|
try avAudioSession.setCategory(.playback)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ensureAudioSessionActivationStateAfterDelay()
|
|
|
|
ensureAudioSessionActivationStateAfterDelay()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -215,8 +215,3 @@ public class OWSAudioSession: NSObject {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Helper function inserted by Swift 4.2 migrator.
|
|
|
|
|
|
|
|
private func convertFromAVAudioSessionCategory(_ input: AVAudioSession.Category) -> String {
|
|
|
|
|
|
|
|
return input.rawValue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|