Fix video display in call view

This commit is contained in:
Benoit Martins 2024-01-12 16:01:04 +01:00 committed by QuentinArguillere
parent 2f1bd572b0
commit 937444c5d0
2 changed files with 8 additions and 9 deletions

View file

@ -82,7 +82,7 @@ struct CallView: View {
Button {
callViewModel.toggleVideo()
} label: {
Image(callViewModel.cameraDisplayed ? "video-camera" : "video-camera-slash")
Image(telecomManager.remoteVideo ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle((callViewModel.isPaused || telecomManager.isPausedByRemote) ? Color.gray500 : .white)
@ -500,7 +500,7 @@ struct CallView: View {
Spacer()
if callViewModel.cameraDisplayed {
if telecomManager.remoteVideo {
Button {
callViewModel.switchCamera()
} label: {
@ -594,10 +594,12 @@ struct CallView: View {
.scaledToFill()
.clipped()
.onTapGesture {
fullscreenVideo.toggle()
if telecomManager.remoteVideo {
fullscreenVideo.toggle()
}
}
if callViewModel.cameraDisplayed {
if telecomManager.remoteVideo {
HStack {
Spacer()
VStack {
@ -741,7 +743,7 @@ struct CallView: View {
Button {
callViewModel.toggleVideo()
} label: {
Image(callViewModel.cameraDisplayed ? "video-camera" : "video-camera-slash")
Image(telecomManager.remoteVideo ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle((callViewModel.isPaused || telecomManager.isPausedByRemote) ? Color.gray500 : .white)
@ -825,7 +827,7 @@ struct CallView: View {
Button {
callViewModel.toggleVideo()
} label: {
Image(callViewModel.cameraDisplayed ? "video-camera" : "video-camera-slash")
Image(telecomManager.remoteVideo ? "video-camera" : "video-camera-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle((callViewModel.isPaused || telecomManager.isPausedByRemote) ? Color.gray500 : .white)

View file

@ -75,7 +75,6 @@ class CallViewModel: ObservableObject {
//self.avatarModel = ???
self.micMutted = self.currentCall!.microphoneMuted
self.cameraDisplayed = self.currentCall!.cameraEnabled == true
self.isRecording = self.currentCall!.params!.isRecording
self.isPaused = self.isCallPaused()
self.timeElapsed = 0
@ -139,8 +138,6 @@ class CallViewModel: ObservableObject {
"[CallViewModel] Updating call with video enabled set to \(params.videoEnabled)"
)
try self.currentCall!.update(params: params)
self.cameraDisplayed = self.currentCall!.cameraEnabled == true
} catch {
}