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
Hi everyone,
Just for fun, I made a small project where I want to capture data from the camera, microphone, and geoposition. On desktop, requesting device access through the website was straightforward, and I used the following JavaScript code (Next.js):
useEffect(()=>{asyncfunctiongetCameraStream(){try{conststream=awaitnavigator.mediaDevices.getUserMedia({video: true});videoRef.current.srcObject=stream;setPermissionGranted(true);}catch(err){console.error("Error accessing camera: ",err);setError("Permission denied or no camera available.");}}getCameraStream();},[]);
This worked fine on desktop. But, on mobile I get error catch with "No permission". I found an official "Barcode Scanner" plugin for mobile, but I didn’t fully understand how the permission request for the camera is implemented there.
Could anyone guide me on how to request camera access permission on mobile devices when using Next.js? Are there best practices or specific examples I should follow?
I have already read the issue #4434 . But... I got nothing from it. By that question it would excellent if someone could explain how to request permissions overall.
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Thanks, that solved the most part of problem. However, I’d like to know how to implement the permission request. For example, how can I trigger a dialog to ask for camera permissions in Rust and/or JS?
Discussed in #12039
Hi everyone,
Just for fun, I made a small project where I want to capture data from the camera, microphone, and geoposition. On desktop, requesting device access through the website was straightforward, and I used the following JavaScript code (Next.js):
This worked fine on desktop. But, on mobile I get error catch with "No permission". I found an official "Barcode Scanner" plugin for mobile, but I didn’t fully understand how the permission request for the camera is implemented there.
Could anyone guide me on how to request camera access permission on mobile devices when using Next.js? Are there best practices or specific examples I should follow?
I have already read the issue #4434 . But... I got nothing from it. By that question it would excellent if someone could explain how to request permissions overall.
Thanks in advance!
The text was updated successfully, but these errors were encountered: