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

Allow support for any videoOrientation #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampl
public var preset: AVCaptureSession.Preset = .high
public var videoGravity: AVLayerVideoGravity = .resizeAspectFill
public var lowLightBoost: Bool = false

public var videoOrientation: AVCaptureVideoOrientation = .portrait
public var tapToFocus: Bool = false
public var flashMode: AVCaptureDevice.FlashMode = .off

Expand All @@ -49,7 +49,7 @@ open class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampl

let previewLayer = AVCaptureVideoPreviewLayer(session: session)
previewLayer.videoGravity = videoGravity
previewLayer.connection?.videoOrientation = .portrait
previewLayer.connection?.videoOrientation = videoOrientation
view.layer.insertSublayer(previewLayer, at: 0)
self.previewLayer = previewLayer

Expand Down Expand Up @@ -94,7 +94,7 @@ open class CameraViewController: UIViewController, AVCaptureVideoDataOutputSampl

previewLayer?.frame = view.bounds
previewLayer?.videoGravity = videoGravity
previewLayer?.connection?.videoOrientation = .portrait
previewLayer?.connection?.videoOrientation = videoOrientation
}

public func takePhoto() {
Expand Down