You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue with certain Samsung devices (e.g. S22) where the camera fails to focus properly, resulting in blurry QR codes that cannot be scanned. Upon researching potential solutions on the internet, it appears that setting the auto-focus constraint focusMode: continuous may resolve the issue. Here's an example of how I try to use the constraints:
However, when attempting to set the focusMode property, I encountered the following error:
Type '{ facingMode: string; focusMode: string; }' is not assignable to type 'MediaTrackConstraints'.
Object literal may only specify known properties, and 'focusMode' does not exist in type 'MediaTrackConstraints'.
Upon inspecting the library source code, I observed that the constraints prop is passed to the Finder component and utilized in the useMediaDevices hook, as seen here: useMediaDevices.ts.
Additionally, I noticed that there is an open issue (#22) on the repository regarding similar zoom constraint problem.
It seems logical to me that it should be possible to pass constraints such as focusMode or zoom to window.navigator.mediaDevices, especially when browser console output from navigator.mediaDevices.getSupportedConstraints() clearly states that those constraints do exist in the browser API.
I'm facing the same issue with focusMode apparently not being a property anymore. However the Scanner works flawlessly on Android phones for me (default config), and not at all on iPhones. Since you said that it works flawlessly on Apple devices, would you mind sharing your config? 😅
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I encountered an issue with certain Samsung devices (e.g. S22) where the camera fails to focus properly, resulting in blurry QR codes that cannot be scanned. Upon researching potential solutions on the internet, it appears that setting the auto-focus constraint
focusMode: continuous
may resolve the issue. Here's an example of how I try to use the constraints:However, when attempting to set the
focusMode
property, I encountered the following error:Upon inspecting the library source code, I observed that the
constraints
prop is passed to theFinder
component and utilized in theuseMediaDevices
hook, as seen here: useMediaDevices.ts.Additionally, I noticed that there is an open issue (#22) on the repository regarding similar zoom constraint problem.
It seems logical to me that it should be possible to pass constraints such as
focusMode
orzoom
towindow.navigator.mediaDevices
, especially when browser console output fromnavigator.mediaDevices.getSupportedConstraints()
clearly states that those constraints do exist in the browser API.Sources:
https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#focusmode
https://forum.developer.samsung.com/t/camera-auto-focus-and-zoom-camera-not-working-in-the-web-application/27908/1
mebjas/html5-qrcode#308
Besides that, it is a great library and works flawlessly on apple devices without any problems.
Kindly requesting @yudielcurbelo for any assistance or suggestions on how to address these issues.
The text was updated successfully, but these errors were encountered: