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

@@ -195,6 +195,7 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC
self.delegate?.onSessionInitialized()
}
self.delegate?.onCameraConfigurationChanged(config, difference)
// After configuring, set this to the new configuration.
self.configuration = config
} catch {

View File

@@ -21,6 +21,8 @@ protocol CameraSessionDelegate: AnyObject {
Called when the [CameraSession] successfully initializes
*/
func onSessionInitialized()
func onCameraConfigurationChanged(_ configuration: CameraConfiguration?, _ difference: CameraConfiguration.Difference?)
/**
Called when the [CameraSession] starts streaming frames. (isActive=true)
*/