mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix call video display
This commit is contained in:
parent
de9656d94d
commit
91c6f7a311
2 changed files with 37 additions and 34 deletions
|
|
@ -1938,9 +1938,9 @@ struct CallView: View {
|
|||
.frame(width: buttonSize, height: buttonSize)
|
||||
.background(Color.gray500)
|
||||
.cornerRadius(40)
|
||||
.disabled(callViewModel.isPaused || telecomManager.isPausedByRemote)
|
||||
.disabled(callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted)
|
||||
|
||||
if callViewModel.isPaused || telecomManager.isPausedByRemote {
|
||||
if callViewModel.isPaused || telecomManager.isPausedByRemote || telecomManager.outgoingCallStarted {
|
||||
Color.gray600.opacity(0.8)
|
||||
.cornerRadius(40)
|
||||
.allowsHitTesting(false)
|
||||
|
|
|
|||
|
|
@ -713,32 +713,35 @@ class CallViewModel: ObservableObject {
|
|||
|
||||
func displayMyVideo() {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
if self.currentCall != nil {
|
||||
guard let call = self.currentCall else { return }
|
||||
|
||||
let invalidStates: [Call.State] = [.Released, .End, .Error, .Idle]
|
||||
|
||||
guard !invalidStates.contains(call.state) else {
|
||||
Log.warn("\(CallViewModel.TAG) displayMyVideo called in invalid state: \(call.state), skipping update")
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
let params = try core.createCallParams(call: self.currentCall)
|
||||
let params = try core.createCallParams(call: call)
|
||||
|
||||
if (params.videoEnabled == false) {
|
||||
Log.info("\(CallViewModel.TAG) Conference found and video disabled in params, enabling it")
|
||||
if !params.videoEnabled {
|
||||
Log.info("\(CallViewModel.TAG) Video disabled in params, enabling it")
|
||||
params.videoEnabled = true
|
||||
params.videoDirection = MediaDirection.SendRecv
|
||||
params.videoDirection = .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
|
||||
if params.videoDirection == .SendRecv || params.videoDirection == .SendOnly {
|
||||
Log.info("\(CallViewModel.TAG) Video already enabled, switching to recv only")
|
||||
params.videoDirection = .RecvOnly
|
||||
} else {
|
||||
Log.info(
|
||||
"\(CallViewModel.TAG) Conference found with video already enabled, changing video media direction to send & receive"
|
||||
)
|
||||
params.videoDirection = MediaDirection.SendRecv
|
||||
Log.info("\(CallViewModel.TAG) Video already enabled, switching to send & recv")
|
||||
params.videoDirection = .SendRecv
|
||||
}
|
||||
}
|
||||
|
||||
try self.currentCall!.update(params: params)
|
||||
try call.update(params: params)
|
||||
|
||||
let video = params.videoDirection == .SendRecv || params.videoDirection == .SendOnly
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + (video ? 1 : 0)) {
|
||||
if video {
|
||||
self.videoDisplayed = false
|
||||
|
|
@ -746,11 +749,11 @@ class CallViewModel: ObservableObject {
|
|||
self.videoDisplayed = video
|
||||
}
|
||||
} catch {
|
||||
Log.error("\(CallViewModel.TAG) Failed to update video params: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func toggleVideoMode(isAudioOnlyMode: Bool) {
|
||||
coreContext.doOnCoreQueue { core in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue