File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,18 @@ extension CodeScannerView {
178
178
@objc func updateOrientation( ) {
179
179
guard let orientation = view. window? . windowScene? . interfaceOrientation else { return }
180
180
guard let connection = captureSession? . connections. last, connection. isVideoOrientationSupported else { return }
181
- connection. videoOrientation = AVCaptureVideoOrientation ( rawValue: orientation. rawValue) ?? . portrait
181
+ switch orientation {
182
+ case . portrait:
183
+ connection. videoOrientation = . portrait
184
+ case . landscapeLeft:
185
+ connection. videoOrientation = . landscapeLeft
186
+ case . landscapeRight:
187
+ connection. videoOrientation = . landscapeRight
188
+ case . portraitUpsideDown:
189
+ connection. videoOrientation = . portraitUpsideDown
190
+ default :
191
+ connection. videoOrientation = . portrait
192
+ }
182
193
}
183
194
184
195
override public func viewDidAppear( _ animated: Bool ) {
You can’t perform that action at this time.
0 commit comments