zxing-js / ngx-scanner

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

Cordova Android app #543

Open GulharaKam opened 10 months ago

GulharaKam commented 10 months ago

Scan

Hello, I am using the ZXingScanner in an Android application through Cordova. I have the permissions , and the plugins cordova-plugin-camera and cordova-plugin-android-permissions are installed. Although the image appears, the ZXingScanner is not functioning on Android, and the camera does not respond. However, there are no issues in the browser. Please help me identify the problem.

Scan

maatien commented 1 month ago

Hi, I've got a similar problem with a Capacitor based app on Android. The "video play image" appears for a few seconds until the camera is fully initialized, then the video preview is displayed correctly.

2024-09-20 16:14:57.713 31249-31632 cr_VideoCapture         my.video.app                      E  CameraDevice.StateCallback onOpened
2024-09-20 16:14:58.021 31249-31632 my.video.app            my.video.app                      W  Attempt to remove non-JNI local reference
2024-09-20 16:14:58.026 31249-31343 cr_media                my.video.app                      W  Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording
2024-09-20 16:14:58.143 31249-31249 Capacitor/Console       my.video.app                      I  File: http://localhost/chunk-UDCQAGSZ.js - Line 23 - Msg: camerasFoundHandler [object Object],[object Object]
2024-09-20 16:14:58.158 31249-31249 Capacitor/Console       my.video.app                      I  File: http://localhost/chunk-UDCQAGSZ.js - Line 23 - Msg: autostartedHandler undefined
2024-09-20 16:14:58.161 31249-31249 Capacitor/Console       my.video.app                      W  File: http://localhost/chunk-UDCQAGSZ.js - Line 23 - Msg: Setting the same device is not allowed.
2024-09-20 16:14:58.999 31249-31676 cr_VideoCapture         my.video.app                      E  CameraDevice.StateCallback onOpened
2024-09-20 16:14:59.557 31249-31676 my.video.app            my.video.app                      W  Attempt to remove non-JNI local reference
2024-09-20 16:14:59.607 31249-31249 Capacitor/Console       my.video.app                      I  File: http://localhost/chunk-UDCQAGSZ.js - Line 23 - Msg: onTorchCompatible true

In the corresponding log, "CameraDevice.StateCallback onOpened" is called twice and the video preview stream is only available after the second call.

On iOS and Web the problem doen't occur.

Does anyone has any recommendations how to handle this?