Have ElementCall always default to the speaker; prevent the lock button from ending the call
- previously handled in 81d669e5ce
- seems the default behavior changed and we now need to manually configure the AudioSession
This commit is contained in:
committed by
Stefan Ceriu
parent
2c23205b35
commit
69ce39bbc3
@@ -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