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

Viewed 1661

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

3 Answers

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.

Would it be Chrome specifically that hinders the code from working properly? I suggest using a different browser such as Firefox in order to test this theory. If it does succeed on Firefox, then the simple answer is: Chrome has yet to implement it yet.

Here are some tests, I included user agent:

Didn't worked with :

  • Android Chrome: Mozilla/5.0 (Linux; Android 6.0; Ilium X510) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36
  • Android Firefox: Mozilla/5.0 (Android 6.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0

Worked with :

  • IPhone Chrome: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/75.0.3770.103 Mobile/15E148 Safari/605.1
  • IPhone Safari: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1

In Summary:

  • All tested iPhone navigators displayed the front camera view when capture is user, and back camera view if it is environment.
  • Both tested Android navigators displayed always the back camera view.

So regardless the information in the accepted answer, it doesn't seem to be a browser issue. It would be helpful if it works correctly with an Android device and a specific browser.

I hope other people can share tests on their Android devices, in particular on working ones, displaying front camera view while testing the capture="user" attribute-value.

Related