I am using this barcodescanner (https://github.com/wildabeast/BarcodeScanner) on an app made using Cordova, specifically aimed at using on an Android device.
I have the following function set up in JavaScript:
$(document).ready(function(){
$('#scanner').click( function(){
console.log('clicked'); //to see if the function is firing
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
});
});
as mentioned in the documentation provided for this plugin. I have added it into my project using the cordova CLI:
$ cordova add plugin https://github.com/wildabeast/BarcodeScanner.git
When I list the available plugins for my projects I can see that it is installed correctly. Also I can use the camera in my app with the button firing off the correct function and can scan using the back camera with no issues.
Is there any way of using the front camera for the scan? If it is not in the plugin, is there any way of setting the default camera used by the device, in the code, to use the front facing camera by default? The app that we are developing needs to specifically use the front facing camera only and does not need the back facing camera.
Any help will be appreciated.