Instead of giving choices to the users, especially in mobile I would like to make default camera should be back camera.
Is there any option for that?
Again, I want the same as you, so I created a method called chooseDevice, which is available in 1.0.0-dev.
And again, I'll post updates soon :)
Basically you will be able to see all available videoinputdevices and iterate'em, so you will need to check if that item is the camera you want, if it is, just call NgxZxingComponent.chooseDevice and pass the choosen device to the method. (the names can differ from the latest version)
Fixed in #28.
You can use the dev version, which should be more stable than 0.3.x.
Did this changes get checked in to NPM package, @zxing/ngx-scanner which is now version 1.3.0 ?
I'm not seeing the NgxZxingComponent.chooseDevice method.
Yes, it's now changeDevice.
@odahcam Is this still accurate? With changeDevice I am now getting "Property 'changeDevice' does not exist on type 'ZXingScannerComponent'."
Just set scanner.device = myDevice or bind it like <zxing-scanner [device]="myDevice" />.
OK, thank you - I have been able to implement it using [device]. Perhaps the reference to changeDevice() should be removed from the StackBlitz in the future to avoid confusion since [(device)]="currentDevice" is already implemented there?
I get this same issue, and when i remove of "Property 'changeDevice' does not exist on type 'ZXingScannerComponent'." and this is my
<zxing-scanner #scanner [scannerEnabled]="scannerEnabled" [device]="currentDevice" (scanSuccess)="handleQrCodeResult($event)" [formats]="['QR_CODE', 'EAN_13', 'CODE_128', 'DATA_MATRIX']"></zxing-scanner>
when i remove changeDevice i get this Can't bind to 'scannerEnabled' since it isn't a known property of 'zxing-scanner'. and then when i remove even that from the code i get "The device must be a valid MediaDeviceInfo or null."
The APIs changed, scannerEnabled is now enable and the change or choose device does not exists anymore. Just bind to the [device]="myDevice" and change it as you want.
Most helpful comment
Again, I want the same as you, so I created a method called
chooseDevice, which is available in1.0.0-dev.And again, I'll post updates soon :)