yuriy-budiyev / code-scanner

Code scanner library for Android, based on ZXing
MIT License
1.09k stars 266 forks source link

How to set Zoom in Camera using Code Scanner ? #168

Open vtangade opened 1 year ago

vtangade commented 1 year ago

I want to set Zoom in Camera but not able achieve this using Code Scanner, please suggest any solution.

I'm currently using following version :

implementation 'com.github.yuriy-budiyev:code-scanner:2.3.2'

abdellatif-laghjaj commented 1 year ago

I found a solution, You can add a slider in the view and then based on the value you can change the zoom value of the camera using this code: code_scanner.zoom = value

hushenghao commented 1 year ago

Zoom value needs to be calculated according to maxZoom, but there is no external api.

You can only get it using the Android Api camera.getParameters().getMaxZoom()

You can refer CodeScannerKtx.kt to access getMaxZoom(), which uses reflection to access some private properties.