mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-14 21:15:37 +00:00
ui: do not enable speaker in calls when contact turned on video (#4998)
This commit is contained in:
committed by
GitHub
parent
6907f02ea6
commit
35fc0544a0
@@ -434,12 +434,12 @@ struct ActiveCallOverlay: View {
|
||||
audioDevicePickerButton()
|
||||
}
|
||||
}
|
||||
.onChange(of: call.hasVideo) { hasVideo in
|
||||
.onChange(of: call.localMediaSources.hasVideo) { hasVideo in
|
||||
let current = AVAudioSession.sharedInstance().currentRoute.outputs.first?.portType
|
||||
let speakerEnabled = current == .builtInSpeaker
|
||||
let receiverEnabled = current == .builtInReceiver
|
||||
// react automatically only when speaker or receiver were selected, otherwise keep an external device selected
|
||||
if hasVideo != speakerEnabled && (speakerEnabled || receiverEnabled) {
|
||||
// react automatically only when receiver were selected, otherwise keep an external device selected
|
||||
if !speakerEnabled && hasVideo && receiverEnabled {
|
||||
client.setSpeakerEnabledAndConfigureSession(!speakerEnabled, skipExternalDevice: true)
|
||||
call.speakerEnabled = !speakerEnabled
|
||||
}
|
||||
|
||||
+3
-2
@@ -226,8 +226,9 @@ actual fun ActiveCallView() {
|
||||
ActiveCallOverlay(call, chatModel, callAudioDeviceManager)
|
||||
}
|
||||
}
|
||||
KeyChangeEffect(call?.hasVideo) {
|
||||
if (call != null) {
|
||||
KeyChangeEffect(call?.localMediaSources?.hasVideo) {
|
||||
if (call != null && call.hasVideo && callAudioDeviceManager.currentDevice.value?.type == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) {
|
||||
// enabling speaker on user action (peer action ignored) and not disabling it again
|
||||
callAudioDeviceManager.selectLastExternalDeviceOrDefault(call.hasVideo, true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user