I'm developing an internal web application for our organization. The app will be used primarily (if not exclusively) from desktop/laptop machines.
I need to give the user the ability to snap an image of themselves. I've followed the example posted by David Walsh here.
This works fine if the user has a single camera on their computer. However, on machines that have both a front and rear camera (like a Surface Pro 4), this code defaults to the rear facing camera. I tried tweaking the code like so:
navigator.mediaDevices.getUserMedia({video: {facingMode: "user"}, audio: false}).then(...)
However, this made no difference. I'm guessing that was primarily intended for mobile devices.
Is there any way to force the camera to the front if its available or, better yet, enable the user to switch cameras on a laptop device with both a front and rear camera?