INNER CODE UNIT · Swift
updateVideoOrientation
wu9007/qrcode_scanner · ios/Classes/SwiftQrscanPlugin.swift:378
private func updateVideoOrientation() {
let orientation = Self.captureOrientation()
if let connection = previewLayer?.connection, connection.isVideoOrientationSupported {
connection.videoOrientation = orientation
}
if let connection = videoConnection, connection.isVideoOrientationSupported {
connection.videoOrientation = orientation
}
}
private static func captureOrientation() -> AVCaptureVideoOrientation {
let interface: UIInterfaceOrientation
if #available(iOS 13.0, *) {
if let scene = UIApplication.shared.connectedScenes.compactMap({ $0 as? UIWindowScene }).first {
interface = scene.interfaceOrientation
} else {
interface = .portrait
}