I tried the following attribute capture
to set the input
element to try to select the front facing camera. user
is front facing, and environment
is back facing.
However, while experimenting with Chrome (latest) on mobile (Pixel 1, latest OS), the back camera is still selected.
I used an example snippet:
<form action="server.cgi" method="post" enctype="multipart/form-data">
<input type="file" name="image" accept="image/*" capture="user">
<input type="submit" value="Upload">
</form>
(from https://w3c.github.io/html-media-capture/#the-capture-attribute)
I am able to change accept
to require video
on my phone, so that and other attributes work, but not the capture
attribute.
EDIT: Am using the latest Android Chrome browser. The following page implies that iOS and older versions of Android Chrome cannot use capture
altogether, but otherwise can use capture
. https://caniuse.com/#search=html-media-capture