Skip to content
Snippets Groups Projects
Commit fc23cfe4 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

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
parent a1af4088
No related branches found
No related tags found
No related merge requests found
...@@ -509,6 +509,7 @@ class CallViewModel: Stateable, ViewModel { ...@@ -509,6 +509,7 @@ class CallViewModel: Stateable, ViewModel {
func switchCamera() { func switchCamera() {
self.videoService.switchCamera() self.videoService.switchCamera()
videoService.setCameraOrientation(orientation: UIDevice.current.orientation, forceUpdate: true)
} }
func switchSpeaker() { func switchSpeaker() {
......
...@@ -380,7 +380,7 @@ class VideoService: FrameExtractorDelegate { ...@@ -380,7 +380,7 @@ class VideoService: FrameExtractorDelegate {
}).disposed(by: self.disposeBag) }).disposed(by: self.disposeBag)
} }
func setCameraOrientation(orientation: UIDeviceOrientation) { func setCameraOrientation(orientation: UIDeviceOrientation, forceUpdate: Bool = false) {
var newOrientation: AVCaptureVideoOrientation var newOrientation: AVCaptureVideoOrientation
switch orientation { switch orientation {
case .portrait: case .portrait:
...@@ -394,7 +394,7 @@ class VideoService: FrameExtractorDelegate { ...@@ -394,7 +394,7 @@ class VideoService: FrameExtractorDelegate {
default: default:
newOrientation = AVCaptureVideoOrientation.portrait newOrientation = AVCaptureVideoOrientation.portrait
} }
if newOrientation == self.currentOrientation { if newOrientation == self.currentOrientation && !forceUpdate {
self.log.warning("no orientation change required") self.log.warning("no orientation change required")
return return
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment