From 17de6c5451ad86edddf438760ec4b51b993be850 Mon Sep 17 00:00:00 2001 From: Arne de Bree Date: Thu, 15 Mar 2018 11:30:49 +0100 Subject: [PATCH] Align previewLayer orientation with device Do not hardcode the initial previewlayer orientation to portrait but follow the device orientation --- src/ios/CDVBarcodeScanner.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ios/CDVBarcodeScanner.mm b/src/ios/CDVBarcodeScanner.mm index c8dc56d1..2ed55a68 100644 --- a/src/ios/CDVBarcodeScanner.mm +++ b/src/ios/CDVBarcodeScanner.mm @@ -924,7 +924,7 @@ - (void)viewDidAppear:(BOOL)animated { previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; if ([previewLayer.connection isVideoOrientationSupported]) { - [previewLayer.connection setVideoOrientation:AVCaptureVideoOrientationPortrait]; + [previewLayer.connection setVideoOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; } [self.view.layer insertSublayer:previewLayer below:[[self.view.layer sublayers] objectAtIndex:0]];