Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Align previewLayer orientation with device
Browse files Browse the repository at this point in the history
Do not hardcode the initial previewlayer orientation to portrait but follow the device orientation
  • Loading branch information
adebree authored Mar 15, 2018
1 parent b508cd3 commit 17de6c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ios/CDVBarcodeScanner.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand Down

0 comments on commit 17de6c5

Please sign in to comment.