androidhtmlmobile-chromemediacapture

Why doesn't capture="user" change my phone's camera to front facing?


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


Solution

  • 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.