mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Have ElementCall always default to the speaker; prevent the lock button from ending the call
- previously handled in 7818fa626a
- seems the default behavior changed and we now need to manually configure the AudioSession
This commit is contained in:
committed by
Stefan Ceriu
parent
3b8da1c92d
commit
4080ff199f
@@ -103,6 +103,17 @@ class ElementCallService: NSObject, ElementCallServiceProtocol, PKPushRegistryDe
|
||||
} catch {
|
||||
MXLog.error("Failed requesting start call action with error: \(error)")
|
||||
}
|
||||
|
||||
do {
|
||||
// Have ElementCall default to the speaker so that the lock button doesn't end the call.
|
||||
// Could also use `overrideOutputAudioPort` but the documentation is clear about it:
|
||||
// `Sessions using PlayAndRecord category that always want to prefer the built-in
|
||||
// speaker output over the receiver, should use AVAudioSessionCategoryOptionDefaultToSpeaker instead.`.
|
||||
try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .videoChat, options: [.defaultToSpeaker])
|
||||
try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation)
|
||||
} catch {
|
||||
MXLog.error("Failed setting up audio session with error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
func tearDownCallSession() {
|
||||
|
||||
Reference in New Issue
Block a user