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

preview frame fix in case of using SwiftyCamViewController as a child vc #220

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
10 changes: 7 additions & 3 deletions Source/SwiftyCamViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ open class SwiftyCamViewController: UIViewController {

}

override open func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

private func updatePreviewLayer() {
if let connection = self.previewLayer?.videoPreviewLayer.connection {

let currentDevice: UIDevice = UIDevice.current
Expand Down Expand Up @@ -394,6 +392,11 @@ open class SwiftyCamViewController: UIViewController {
}
}

override open func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
updatePreviewLayer()
}

// MARK: ViewWillAppear

/// ViewWillAppear(_ animated:) Implementation
Expand Down Expand Up @@ -430,6 +433,7 @@ open class SwiftyCamViewController: UIViewController {
// Preview layer video orientation can be set only after the connection is created
DispatchQueue.main.async {
self.previewLayer.videoPreviewLayer.connection?.videoOrientation = self.orientation.getPreviewLayerOrientation()
self.updatePreviewLayer()
}

case .notAuthorized:
Expand Down