From 2b79b9507960d7dd79f5c4f1a9f93e20f6bbe4b6 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Tue, 8 Jul 2025 09:28:00 +0200 Subject: [PATCH] Set videoEnabled to false when audio call starts --- Linphone/TelecomManager/TelecomManager.swift | 8 ++++-- .../UI/Call/ViewModel/CallViewModel.swift | 26 +++++++++++-------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Linphone/TelecomManager/TelecomManager.swift b/Linphone/TelecomManager/TelecomManager.swift index d6215cc5b..c51834e2e 100644 --- a/Linphone/TelecomManager/TelecomManager.swift +++ b/Linphone/TelecomManager/TelecomManager.swift @@ -254,8 +254,12 @@ class TelecomManager: ObservableObject { lcallParams.videoEnabled = false }*/ } else { - lcallParams.videoEnabled = true - lcallParams.videoDirection = isVideo ? MediaDirection.SendRecv : MediaDirection.Inactive + if isVideo { + lcallParams.videoEnabled = true + lcallParams.videoDirection = MediaDirection.SendRecv + } else { + lcallParams.videoEnabled = false + } } if let call = core.inviteAddressWithParams(addr: addr, params: lcallParams) { diff --git a/Linphone/UI/Call/ViewModel/CallViewModel.swift b/Linphone/UI/Call/ViewModel/CallViewModel.swift index e235c81ae..6002d2154 100644 --- a/Linphone/UI/Call/ViewModel/CallViewModel.swift +++ b/Linphone/UI/Call/ViewModel/CallViewModel.swift @@ -699,17 +699,21 @@ class CallViewModel: ObservableObject { do { let params = try core.createCallParams(call: self.currentCall) - params.videoEnabled = true - - if params.videoEnabled { - if params.videoDirection == .SendRecv { - params.videoDirection = .RecvOnly - } else if params.videoDirection == .RecvOnly { - params.videoDirection = .SendRecv - } else if params.videoDirection == .SendOnly { - params.videoDirection = .Inactive - } else if params.videoDirection == .Inactive { - params.videoDirection = .SendRecv + if (params.videoEnabled == false) { + Log.info("\(CallViewModel.TAG) Conference found and video disabled in params, enabling it") + params.videoEnabled = true + params.videoDirection = MediaDirection.SendRecv + } else { + if (params.videoDirection == MediaDirection.SendRecv || params.videoDirection == MediaDirection.SendOnly) { + Log.info( + "\(CallViewModel.TAG) Conference found with video already enabled, changing video media direction to receive only" + ) + params.videoDirection = MediaDirection.RecvOnly + } else { + Log.info( + "\(CallViewModel.TAG) Conference found with video already enabled, changing video media direction to send & receive" + ) + params.videoDirection = MediaDirection.SendRecv } }