zxing-js / ngx-scanner

Angular QR code, Barcode, DataMatrix, scanner component using ZXing.
https://zxing-js.github.io/ngx-scanner/
MIT License
638 stars 227 forks source link

How to use highest possible resolution for ngx-scanner with Angular 13 #525

Open maerni opened 1 year ago

maerni commented 1 year ago

Hi

We have an Angular 13 application and now ant to use the ngx-scanner to scan QR codes. We use the following versions:

"@zxing/browser": "^0.1.3", "@zxing/library": "^0.20.0", "@zxing/ngx-scanner": "^3.5.0",

The problem is, that the scanning of small QR codes does not work.

How we can set the highest possible resolution for the ngx-scanner? We think, when the resolution is higher, the scanning of the small QR codes should work.

Thanks very much.

Best regards Mike

hardik-hns commented 2 months ago

Hi @maerni , Below link would be useful for you as it worked for me - https://github.com/zxing-js/ngx-scanner/issues/535#issue-1890431278

I added below code in my component and it works -

ZXingScannerComponent.prototype.getAnyVideoDevice = (): Promise<MediaStream> => { return navigator.mediaDevices.getUserMedia({ audio: false, video: { width: { min: 640, ideal: 1920 }, height: { min: 400, ideal: 1080 }, aspectRatio: { ideal: 1.7777777778 } } }); };