Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launching gallery camera from landscape mode doesn't orient video in landscape #64

Closed
LordOfTheRains opened this issue Nov 15, 2017 · 0 comments

Comments

@LordOfTheRains
Copy link

Hi,
I am having a minor issue on launching the camera on ipad from landscape, the default connection video orientation is always portrait. but rotating the device fixes the issue. looking through the code it looks like the preview layer for cameraView initialization didn't start with the current device orientation. Just thought I bring this up.

This library is a pleasure to use, thanks for the great work!

i fixed it by doing the following changes in cameraView.swift if you decided to use it.

func setupPreviewLayer(_ session: AVCaptureSession) {
guard previewLayer == nil else { return }

let layer = AVCaptureVideoPreviewLayer(session: session)
layer.autoreverses = true
layer.videoGravity = .resizeAspectFill
//-----adding the following code here seems to fix the issue --------------
if let connection = layer.connection,
connection.isVideoOrientationSupported {
connection.videoOrientation = Utils.videoOrientation()
}
//-----end fix--------------
self.layer.insertSublayer(layer, at: 0)
layer.frame = self.layer.bounds

previewLayer = layer
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant