From fc23cfe4a12119a7a169d1a23ca37d33d41cb122 Mon Sep 17 00:00:00 2001 From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Thu, 30 Apr 2020 20:02:27 -0400 Subject: [PATCH] video: update orientation after switch input Because front and back camera have different mirroring settings this ensure that after switch input video displayed correctly. Change-Id: I8490d334fb58dbf0c81c82541db03649deb7335f --- Ring/Ring/Calls/CallViewModel.swift | 1 + Ring/Ring/Services/VideoService.swift | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Ring/Ring/Calls/CallViewModel.swift b/Ring/Ring/Calls/CallViewModel.swift index 299fc4497..4d5601861 100644 --- a/Ring/Ring/Calls/CallViewModel.swift +++ b/Ring/Ring/Calls/CallViewModel.swift @@ -509,6 +509,7 @@ class CallViewModel: Stateable, ViewModel { func switchCamera() { self.videoService.switchCamera() + videoService.setCameraOrientation(orientation: UIDevice.current.orientation, forceUpdate: true) } func switchSpeaker() { diff --git a/Ring/Ring/Services/VideoService.swift b/Ring/Ring/Services/VideoService.swift index 6569f027d..2f79eca59 100644 --- a/Ring/Ring/Services/VideoService.swift +++ b/Ring/Ring/Services/VideoService.swift @@ -380,7 +380,7 @@ class VideoService: FrameExtractorDelegate { }).disposed(by: self.disposeBag) } - func setCameraOrientation(orientation: UIDeviceOrientation) { + func setCameraOrientation(orientation: UIDeviceOrientation, forceUpdate: Bool = false) { var newOrientation: AVCaptureVideoOrientation switch orientation { case .portrait: @@ -394,7 +394,7 @@ class VideoService: FrameExtractorDelegate { default: newOrientation = AVCaptureVideoOrientation.portrait } - if newOrientation == self.currentOrientation { + if newOrientation == self.currentOrientation && !forceUpdate { self.log.warning("no orientation change required") return } -- GitLab