Re: Comparing capture* API vs <input type="file" accept="...">

On Thu, 03 Dec 2009 10:46:10 +0100, Dominique Hazael-Massieux <>  

> Hi,
> Arve raised yesterday during the call a notion that had been raised
> before: that instead of defining a new interface to grant access to the
> capture devices, we could rely on <input type="file"> with an accept
> attribute set to "video/*", "image/*" or "audio/*"; we would then rely
> (presumably) on a specialized File interface to get access to some
> additional metadata (presumably spatial and time dimensions).
> Some people have voiced concerns about that approach; in the hope of
> facilitating the discussion on this, I have tried to summarize what I
> have understood of the pros and cons of both approach (completed with a
> variant of the <input type="file">, <input type="photo">) on the wiki:
> I hope this can help making progress in that discussion.
> As always, feedback on and additions to this comparison are welcome.

Thanks a bunch for compiling the table, this is useful.

Some comments:

<input type="file" accept="…">, In widgets:

This is currently marked as "awkward to use", not really, an example:

<input id="someForm" type="file" accept="image/*" data-foo="bar"><!-- foo  
and bar is something that to provide a hint to the UA to not launch a file  
chooser, but rather the camera app)
   var ele = document.getElementById('someForm');
   ele.onchange = function() {
     /* Code that handles the changed input, this could be either  
submitting the form, or using FileReader to get the actual content */

In an untrusted context, the code would work the same way, except the user  
would have to click himself.  If the context is somehow trusted [1], does the trick.

The advantage of this approach is that in the "let's grab a picture and  
upload it", this already works without modification. It works on  
camera-less devices, and when FileReader/File is widely deployed by User  
Agents, it will work with very little applied magic.

This is no more awkward than the proposed Capture API

[1] I'm leaving the "trust" bit as an exercise to the reader, or a UA  
implementation detail, not as a "policy" question for now.

Arve Bersvendsen

pera Software ASA,

Received on Thursday, 3 December 2009 10:01:03 UTC