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

How to set Zoom in Camera using Code Scanner ?

Open vtangade opened this issue 3 years ago • 2 comments

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'

vtangade avatar Nov 04 '22 13:11 vtangade

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

abdellatif-laghjaj avatar Nov 14 '22 23:11 abdellatif-laghjaj

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.

hushenghao avatar Feb 09 '23 05:02 hushenghao