The HTML Media Capture spec defines a capture attribute on file inputs
that should open the device camera/mic instead of a file picker.
This works on Android but not on desktop.
Expected: Clicking the file button on inputs with capture
opens Chrome's camera/mic capture dialog.
Broken: The capture attribute is ignored and the normal
OS file picker opens.
HTMLInputElement.prototype.capture is
...
<input type="file" accept="image/*" capture="user">
Opens front camera to take a photo.
<input type="file" accept="image/*" capture="environment">
Opens rear camera to take a photo.
<input type="file" accept="video/*" capture="user">
Opens camera + mic to record a video clip.
<input type="file" accept="audio/*" capture="user">
Opens microphone to record audio.
<input type="file" accept="image/*" capture>
The bare capture attribute (no value) should also trigger the dialog.
<input type="file" accept="image/*">
Without capture, the normal OS file picker should open.
<input type="file" accept="image/*;capture=camera">
The original 2010 spec put capture inside accept. Some sites still use this.
Modern: W3C HTML Media Capture (current)
Legacy: W3C HTML Media Capture (2010 WD)
1. Build Chromium with the patch applied.
2. Open this page in the patched build.
3. Click the file button on Tests 1-5. Each should open Chrome's capture dialog.
4. After capturing, click Check Submission to verify the form has a valid attachment.
5. Test 6 (control) should still open the normal file picker.
6. JS feature detection above should show supported.