-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video is blank when granted camera permissions for the first time #7
Comments
Is there just a delay or does the stream not start at all? Have you got any clues? |
@nomadoda I noticed if you change something in the DOM, which causes a HMR, after that video feed is visible. |
Just giving my 2 cents. I had this same issue and i believe its because of the timing of how things happen. The way I solved it is I made a separate component with the video and useZxing and I only render this component if there are permissions already given. This completely resolved the issue. |
Could you please share your code? I tried getting the permissions in advance with navigator.mediaDevices.getUserMedia({ video: true }), and then conditionally show the scanner component, but it still gave me the error above, and then a bunch of "No MultiFormat Readers were able to detect the code." errors. |
@lenard-a there it is: https://github.com/Shelf-nu/shelf.nu/blob/main/app/routes/_layout%2B/scanner.tsx#L51-L91 |
Thank you! I realized that disabling StrictMode makes it happen much less frequent, but I will check your code to fully fix the issue. |
I notice that in dev mode (my case Nextjs) newly granting camera permission result in empty
<video>
(white box),but in production mode things work fine.
The text was updated successfully, but these errors were encountered: