insightautos / cordova-gmv-barcode-scanner

A Cordova barcode scanning plugin based on the Google Mobile Vision library for iOS & Android.
MIT License
52 stars 77 forks source link

iOS Device Front-Facing Camera #31

Open pjwl33 opened 4 years ago

pjwl33 commented 4 years ago

I'm trying to get a scan using the front-facing camera from an iPad 2 device.

In the CameraViewController.m file, I've changed line 529 from AVCaptureDevicePositionBack to AVCaptureDevicePositionFront

Everything builds successfully and the camera is showing towards the front, as expected, however there is no recognition or focus for the barcode on the front camera.

Any advice on how to achieve this? Thank you.

manojchandrashekar commented 4 years ago

It is possible that the front camera has different dimensions for the image and therefore the cropping logic wouldn't be the same. You will have to look more into how the image is cropped from the actual capture and the cropped image that gets used for detection. Simply changing the cameras will not work.