CameraDirection not work on web
Describe the bug On the web in always use selfie camera whenever CameraDirection is selected in the startScan.
To Reproduce
const result = await BarcodeScanner.startScan({ cameraDirection: 'back', targetedFormats: ['QR_CODE'], showTorchButton: true, showFlipCameraButton: true })
Expected behavior It will start appropriate camera, and allow user to flip them.
Screenshots If applicable, add screenshots to help explain your problem.
Version v3.0.3
Smartphone (please complete the following information):
- Device: iPhone 13 Pro
- OS: iOS 16.4.1
- Browser safari
Additional context Not tried native yet.
Here is deployed app: https://weblibsk--vue3-13854-um4rjdiw.web.app/p/341175
And here it's older version with vue-qrcode-reader where it correcly starts back camera and crops video to cover. https://jeruzalem.weblib.sk/p/341175
Seems like there are multiple issues in one here, I try to catch all of them ;)
We will not implement UI elements in this plugin, you need to create the UI yourself. Therefore things like showTorchButton and showFlipCameraButton will never be implemented.
And as mentioned the web implementation is in beta and might have issues, I will not spend time fixing issues related to the web implementation myself since the implementation will be dropped and replaced by another plugin anyways in an upcoming update. I'm open for PRs though until the new version is finished.
The only thing that would make sense is to implement a function to allow users to easily change the camera direction, something like setCameraDirection. This is currently possible, but only if you stop and restart the scan with the new direction, an easier method would make sense here I guess :)
Could you share you plans about the web plugin please?
Will it be single plugin implementing ios, android and web?
25. 4. 2023 14:15:45, Yannik Ache Eicher @.***> napsal:
Seems like there are multiple issues in one here, I try to catch all of them ;)
We will not implement UI elements in this plugin, you need to create the UI yourself. Therefore things like showTorchButton and showFlipCameraButton will never be implemented.
And as mentioned the web implementation is in beta and might have issues, I will not spend time fixing issues related to the web implementation myself since the implementation will be dropped and replaced by another plugin anyways in an upcoming update. I'm open for PRs though until the new version is finished.
The only thing that would make sense is to implement a function to allow users to easily change the camera direction, something like setCameraDirection. This is currently possible, but only if you stop and restart the scan with the new direction, an easier method would make sense here I guess :)
— Reply to this email directly, view it on GitHub https://github.com/capacitor-community/barcode-scanner/issues/229#issuecomment-1521688164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEV6WHI7QCNM6PEPBEKGN3XC657DANCNFSM6AAAAAAXKX4U2Y . You are receiving this because you authored the thread.Message ID: @.***>
I have the same problem.
I am using an android tablet, which has both front and back cameras. It does not matter how i start the scan, whether it is CameraDirection.FRONT or BACK, it ALWAYS chooses the front camera. Except that mirroring is different. One is mirrored, the other is not.
So in web you cannot choose the back camera at all using
BarcodeScanner.startScan({cameraDirection: CameraDirection.BACK})
In native it works fine, the back camera is selected as expected. I would also be interested when this is fixed for web.
Just looking at the code, it is simply not implemented in web.ts. One would need to do something like this https://stackoverflow.com/questions/22787549/accessing-multiple-camera-javascript-getusermedia
@thegnuu i did a PR for you for this, see here note, this will only make sense on devices that do have a front or back camera. like a tablet or a phone, where you open the app in web mode. on regular desktop you just get whatever camera you have as the first in the list. it will not choose another one. for that, we would need to also add the ability to choose the camera based on deviceId. would be a simple addition...
still not work back camera @capacitor-community/barcode-scanner on vue