fix preview and recording orientation fix

- add onCameraConfigurationChanged to CameraSessionDelegate to notify CameraView when configuration changes
- when orientatin change update CameraView.PreviewView.videoPreviewLayer.connection orientation value
This commit is contained in:
Rui Rodrigues
2024-08-02 14:39:23 +01:00
parent 7c162fecb1
commit 3a20c44a31
5 changed files with 56 additions and 22 deletions

View File

@@ -113,5 +113,19 @@ class ViewController: UIViewController {
}
}
override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
switch UIDevice.current.orientation {
case .landscapeLeft:
cameraView.orientation = "landscape-right"
case .landscapeRight:
cameraView.orientation = "landscape-left"
default:
cameraView.orientation = "portrait"
}
cameraView.didSetProps([])
super.viewWillTransition(to: size, with: coordinator)
}
}