Define `<input capture>`, ideally with a hint for which camera to use
#1102 opened on Apr 22, 2016
Description
2023-12-13 summary by @domenic of the work to be done:
We need to upstream https://w3c.github.io/html-media-capture/ into HTML. The core logic is in https://w3c.github.io/html-media-capture/#the-capture-idl-attribute, and needs to be updated to be consistent with the HTML Standard's existing conventions, such as:
-
Being located in the right place, i.e. in HTML's definition of
HTMLInputElement, the File Upload state, and the "show the picker, if applicable" algorithm. -
Adhering to HTML's editorial style, e.g. defining enumerated attributes using the same table format as other enumerated attributes, using lowercase "must" and "should", etc.
Additionally, some portions of user agent advice that are currently in "security and privacy considerations" need to move into the normative text.
For the examples section, not all of it needs to be ported over, but porting over 1-3 HTML or JS code examples and also the file picker rendering examples to https://html.spec.whatwg.org/#file-upload-state-(type=file) would be good.
Finally, we need to add authoring conformance requirements on the capture attribute. This would be done by modifying all the discussion about "apply" and "do not apply" in https://html.spec.whatwg.org/#the-input-element; use the existing accept attribute as a model. It seems we'll need an additional authoring conformance requirement that the attribute must only be specified if the accept attribute is also specified.
In general, the accept attribute, as another attribute which only applies in the File state, is a good model.
Original post follows:
IIRC <input capture> isn't actually defined in a spec that's being actively maintained, and offhand I don't know why it wouldn't be defined in HTML with the rest of <input>'s attributes. Ideally its value could be taken from VideoFacingModeEnum, (which would be taken as a hint for which camera is preferred). If capture="" has to remain a boolean attribute for compat reasons, I suppose we'll have to mint a new attribute to carry the hint.