Open gregavola opened 5 years ago
For iOS focus, see here. It is triggered on tap. I believe it also does autofocus at regular intervals, but I'm not certain about that.
For Android, the library should just focus (as seen here), and there is no tap to trigger. I expect you'd want to implement the tap to focus in this section.
In regards to certain devices, there's not really a whole lot you can do. iPod touch, for example, iPads, often do not have any focusing mechanism. Check out scandit's demo mobile app and see if their blurry barcode scanning works on the devices you're talking about. If not, well, they've got a great algorithm for that type of thing so not sure if there's much you'll be able to do.
Other thing about focusing is that typically the device is going to need to be held back several inches from the barcode, even if it doesn't fill in the white viewfinder.
@forrestmid It's mainly Android devices, the standard barcode reader apps works fine, but this one doesn't auto focus, even if you pull away - it never re-focuses. Never have an issue with iOS.
@forrestmid Just a heads up - this plugin is awesome, but still has issues with some devices not being able to "FOCUS". My guess is that this (https://github.com/dealrinc/cordova-gmv-barcode-scanner#android-quirks), is the main issue. It doesn't know where to focus so it keep trying to focus everywhere.
We've seen about 30-40 cases in the last month about this - all on weird phones that are European version or just older devices.
If there is a way to limit the focus to the rectangle, that would be extremely helpful - if you have any advice on how to do this I would be all ears, as well as the rest of the users who use this amazing plugin.
@gregavola Sorry for the delay here.
It's really tough for me to do much with the android side of this plugin since I don't have an actual device to test anything on so if you can experiment some here that would be swell.
Autofocus is enabled here. A description of the autofocus mode is described here and if you read before that and after there are a few other autofocus modes that could be useful to us, perhaps that can be surfaced as part of the javascript in cordova. The "Macro" focus mode seems like it might be the most useful to you.
It looks like there is also a Camera.Parameters.setFocusArea
function that might enable autofocus only in the rectangle area. This question seems to provide a lot of insight that might be used to capture a tap and focus the camera on a new area, which seems a better solution than just limiting to the rectangular area.
I've just pushed up a branch that should limit the area of the image that is actually fed to the barcode detector to the viewfinder rectangle so that issue will soon be resolved. If you'd like to test that out for me on a real device that would be appreciated.
Without an android phone I don't think I can implement a new autofocus functionality, but those links above should provide good direction as to how you can start implementation. If you'd like to donate an android phone to me I'd welcome that as well, though no promises as to when I will be able to resolve the issue. 😄
If you'd like to call me to discuss the autofocus issue more you can get my phone number here.
Cheers and let me know if you have other questions!
@forrestmid thanks for working on the plugin while juggling everything else. I'm not sure if it's an autofocus issue, but I've come across slower reading speeds (potentially with iOS updates since the release of the scanner). It used to be very fast but now it sometimes struggles to read the barcode.
I've noticed that reading a barcode with a darker surrounding background is very difficult to read, vs a barcode with a whiter background.
Any info or suggestions for improvement I can do would be helpful! Thank you.
Currently, we have seen lots of users on low-end devices, not able to "auto-focus" when holding the camera right up to the barcode - does this library have tap to focus, or if not - where can one look to add it?