devsm
December 15, 2017, 9:56am
1
This is my code:
scanValidate(){
var qr = this.qrScanner;
var scanResult: string;
qr.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
qr.scan().subscribe((res:string) => {
qr.show()
scanResult = res
console.log(scanResult)
qr.hide()
}).unsubscribe();
}
});
It start the camera on pc, I can see the light on, but on android the camera view doesn’t start and doesn’t work.
Console log:
[Deprecation] Unknown constraint named facingMode rejected
plugin.min.js:1983
URL.createObjectURL(stream) is deprecated! Use elem.srcObject = stream instead!
plugin.min.js:207
I’ve searched along the whole internet, but I can’t find solution that fits…
What plugin you are using?
I’m using the below plugin and it is working fine for me
ionic cordova plugin add phonegap-plugin-barcodescanner
npm install --save @ionic-native /barcode-scanner
Refer this : https://ionicframework.com/docs/native/barcode-scanner/
devsm
December 15, 2017, 4:35pm
3
This is barcode scanner but I need to read qr code… Thanks!!
AceBoy
December 15, 2017, 11:43pm
4
But it also scans QR Code. Just check “BarcodeScanResult” tab - format: ‘QR_CODE’.
It scans QR Code too. Just give a try
devsm
December 18, 2017, 7:46am
6
Oh, I’d lost this function… Thanks!! I’ll try and post if it works
The Barcode scanner reads qr codes any many other types too.
Also: It’s way easier to implement and provides a much better user experience out of the box.
In my opinion, the qr-code scanner plugin should be removed from the docs.
I’m agree with that. Barcode Scanner it’s too easy and well documented plugin and it’s confuse 2 plugins doing same task… the storage plugin anoyed me too