ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

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

Open maerni opened this issue 2 years ago • 1 comments

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

maerni avatar Jun 05 '23 09:06 maerni

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 } } }); };

hardik-hns avatar Jul 09 '24 11:07 hardik-hns