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
Still unable to access you front or rear camera on Android phone? Try this! Go to SETTINGS > APPS & NOTIFICATIONS (select, “See all Apps”) > scroll to CAMERA > tap FORCE STOP, and then OK. Navigate back to your Home Screen, and launch the Camera app again to check that it works.
Make sure that nothing is blocking the camera. Try using the selfie camera in Safe mode. If the camera works, make sure to stick to the stock camera app and uninstall recently-installed apps that might interfere. If the camera doesn't work in third-party apps, check Settings > Apps and grant Camera access permission.
I cloned the chromium repository today (2019-07-21). I then used ripgrep to get a list of files that do not contain capture
. After passing that list to rm
, I removed any directories that were either empty or clearly irrelevant (such as telemetry). Going through the remaining ~50 files was a relatively trivial task.
Hopefully the Chrome team will get around to implementing this in the future, but there is currently no indication that this behavior is supported in official documentation, official blog posts, or the code itself.
I know it's not the answer you'd like to hear, but those are the facts as I've found them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With