Summary
On a phone with several rear cameras the scanner opens a camera that cannot focus, and there is no way to switch to a different one. The barcode never becomes sharp, so scanning is impossible.
Environment
- LibrisLog
ghcr.io/codebude/librislog/librislog:latest, image built 2026-06-22 (API image same build date), self-hosted behind nginx with a trusted internal CA — HTTPS/secure context is fine, permission is granted and the camera starts
- Huawei P30, Android
- Vivaldi (Chromium) — also reproduced in Brave (Chromium)
The device is not the cause
Verified on the same phone, in the same browser:
Camera 4 (facing back) is the only one that cannot focus — evidently a fixed-focus auxiliary lens. So the browser exposes both camera selection and zoom on this device; the app just doesn't use them.
Root cause
The scanner requests the camera like this (/_app/immutable/chunks/BTxGinf0.js in the current image):
await navigator.mediaDevices.getUserMedia({
audio: false,
video: {
facingMode: { ideal: "environment" },
width: { min: 640 },
height: { min: 480 }
}
})
Only facingMode is used, so the browser picks whichever rear camera it considers default and the user cannot influence it. On multi-camera Android phones that default is frequently an ultra-wide or a macro/depth sensor — and several of those are fixed-focus.
The bundled ZXing library does support deviceId: { exact: … } (it is right there in the same chunk), but this code path doesn't use it. No zoom or focusMode constraints are applied either.
Suggested fix
enumerateDevices() → list the videoinput devices and let the user choose, persisting the choice (a phone's "best" lens is not guessable from the label alone).
- Request with
deviceId: { exact: … }, and stop the previous track before switching — otherwise Android tends to hand back the old stream.
- Where
track.getCapabilities() reports them, apply focusMode: "continuous" and expose zoom through applyConstraints().
A "switch camera" button that simply cycles through the available videoinput devices would already make the scanner usable on this class of phone.
Happy to test a build.
Summary
On a phone with several rear cameras the scanner opens a camera that cannot focus, and there is no way to switch to a different one. The barcode never becomes sharp, so scanning is impossible.
Environment
ghcr.io/codebude/librislog/librislog:latest, image built 2026-06-22 (API image same build date), self-hosted behind nginx with a trusted internal CA — HTTPS/secure context is fine, permission is granted and the camera startsThe device is not the cause
Verified on the same phone, in the same browser:
Camera 4 (facing back) is the only one that cannot focus — evidently a fixed-focus auxiliary lens. So the browser exposes both camera selection and zoom on this device; the app just doesn't use them.
Root cause
The scanner requests the camera like this (
/_app/immutable/chunks/BTxGinf0.jsin the current image):Only
facingModeis used, so the browser picks whichever rear camera it considers default and the user cannot influence it. On multi-camera Android phones that default is frequently an ultra-wide or a macro/depth sensor — and several of those are fixed-focus.The bundled ZXing library does support
deviceId: { exact: … }(it is right there in the same chunk), but this code path doesn't use it. NozoomorfocusModeconstraints are applied either.Suggested fix
enumerateDevices()→ list thevideoinputdevices and let the user choose, persisting the choice (a phone's "best" lens is not guessable from the label alone).deviceId: { exact: … }, and stop the previous track before switching — otherwise Android tends to hand back the old stream.track.getCapabilities()reports them, applyfocusMode: "continuous"and exposezoomthroughapplyConstraints().A "switch camera" button that simply cycles through the available
videoinputdevices would already make the scanner usable on this class of phone.Happy to test a build.