File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -311,9 +311,14 @@ open class BarcodeScannerController: UIViewController {
311311
312312 if let videoPreviewLayer = videoPreviewLayer {
313313 videoPreviewLayer. frame = view. layer. bounds
314-
315- if videoPreviewLayer. connection != nil {
316- videoPreviewLayer. connection. videoOrientation = . portrait
314+ if let connection = videoPreviewLayer. connection, connection. isVideoOrientationSupported {
315+ switch ( UIApplication . shared. statusBarOrientation) {
316+ case . portrait: connection. videoOrientation = . portrait
317+ case . landscapeRight: connection. videoOrientation = . landscapeRight
318+ case . landscapeLeft: connection. videoOrientation = . landscapeLeft
319+ case . portraitUpsideDown: connection. videoOrientation = . portraitUpsideDown
320+ default : connection. videoOrientation = . portrait
321+ }
317322 }
318323 }
319324
@@ -337,12 +342,6 @@ open class BarcodeScannerController: UIViewController {
337342 height: size. height)
338343 }
339344
340- // MARK: - Orientation
341-
342- open override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
343- return . portrait
344- }
345-
346345 // MARK: - Animations
347346
348347 /**
You can’t perform that action at this time.
0 commit comments