Question: Is it possible to update `facingMode` without re-rendering Webcam?
bfaulk96 opened this issue · 2 comments
Please follow the general troubleshooting steps first:
- Is your app running over HTTPS? (please provide the URL if possible)
- Have you tried running the demo (https://codepen.io/mozmorris/pen/JLZdoP) on your device?
- Checked the latest "Can I use" compatibility table? (https://caniuse.com/stream)
Question
This is more a general inquiry, not a bug (and perhaps depending on the answer, a feature request?).
I have react-webcam set up in my app and working on multiple browsers and devices. I also have a mechanism set up to switch between user
and environment
cameras (after checking that both exist) prior to recording, by updating videoConstraints={{ ...videoConstraints, facingMode }}
. Unfortunately, while this works great prior to recording, changing this setting mid-recording causes the Webcam component to re-render, which stops the recording.
This brings me to two questions
- Is it possible to use the underlying media recorder ref or webcam ref to update facingMode on the fly, without re-rendering the component? I've tried several things and cannot seem to get that to happen.
- Is this a feature that could be built into this library? I.e. instead of re-rendering, just updating the props of the media recording potentially?
Thank you for your work on this library, and for reading my questions! 😄
Nope, unfortunately not. My solution was to show a loading symbol while the camera re-initializes, and disable facing mode switching once you'd already started recording (since switching ended the video)