This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17879 - Define capture attribute
Summary: Define capture attribute
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 07:10 UTC by contributor
Modified: 2014-09-30 08:53 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:10:59 UTC
This was was cloned from bug 17488 as part of operation convergence.
Originally filed: 2012-06-14 10:48:00 +0000
Original reporter: Anne <annevk@annevk.nl>

================================================================================
 #0   Anne                                            2012-06-14 10:48:46 +0000 
--------------------------------------------------------------------------------
It seems that everyone is planning to implement http://dev.w3.org/2009/dap/camera/ so we should just put it in HTML proper.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-27 23:51:39 UTC
Are there any test cases?
Comment 2 Ian 'Hixie' Hickson 2012-12-29 23:28:54 UTC
I'll have to coordinate with the current spec authors. I'll do that in a few months assuming they have test cases and implementations by then.
Comment 3 Mounir Lamouri 2013-01-07 12:24:32 UTC
FWIW, I think the current version of the spec (a simple boolean attribute) is simple and efficient. It adds the level of semantic that the UA needs to modify its behaviour to try to match what the page wants. It seems also simple enough to be easily added to the HTML specifications. It could be removed later if it happens to not be implemented.

The only issue I see with the current specification is that it requires to have a file picking UI that shows the capturing device which isn't the case on Desktop (AFAIK) and the idea is to default on the capture device and allow the user to switch to regular file picking. That kind of behaviour is not common on mobile platforms that I know.
Comment 4 Tobie Langel 2013-01-07 20:03:41 UTC
(In reply to comment #3)
> That kind of behaviour is
> not common on mobile platforms that I know.

It's how it's implemented in the Android stock browser since 3.0 (though syntax may vary).
Comment 5 Mounir Lamouri 2013-02-19 14:15:22 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > That kind of behaviour is
> > not common on mobile platforms that I know.
> 
> It's how it's implemented in the Android stock browser since 3.0 (though
> syntax may vary).

I would be interested to try that. Do you happen to know which syntax I should use to trigger the UI? I used capture='camera' but it didn't work.
Comment 6 Tobie Langel 2013-02-19 14:20:35 UTC
Syntax looks something like this:
    
     <input type="file" capture="camera" accept="image/*" />

Older versions of Android have a different syntax, I think it's:

     <input type="file" accept="image/*;capture=camera" />

Give this a spin:

https://dl.dropbox.com/u/1330446/camera/vanilla/index.html
Comment 7 Mounir Lamouri 2013-02-19 14:38:39 UTC
(In reply to comment #6)
> Older versions of Android have a different syntax, I think it's:
> 
>      <input type="file" accept="image/*;capture=camera" />

On my device, this is working. However, I am directly sent to the camera capture and I can't fallback to selecting an image from my gallery. My concern was that capture should be a hint and we should allow the user to fallback to something else. Was that solved in newer version of Androd?
Comment 8 Tobie Langel 2013-02-19 14:43:50 UTC
That behavior really is implementation specific, don't you think? Also, on Android, intents should let you pick whatever camera app you want to use and some would implement gallery fallback while others wouldn't.
Comment 9 Anne 2013-02-19 14:47:25 UTC
If it's implementation specific it's not that great for web developers. We have learned time and again that they don't really like that at all.
Comment 10 Tobie Langel 2013-02-19 14:53:58 UTC
The developer's intent here is respected (please use live capture immediately).

If we want tighter requirements for the live capture app to also offer a fallback mode to the file system, I won't object, but it'll be very hard to enforce. Notably on systems which allow the user to pick the camera app he want to invoke in such occasions.
Comment 11 Ian 'Hixie' Hickson 2013-04-12 19:01:47 UTC
I'm still hoping that there might be a test suite for the "HTML Media Capture" spec so I can test browsers and find out how widely implemented it actually is.
Comment 12 Ian 'Hixie' Hickson 2013-10-02 20:45:01 UTC
I did some tests of this on Android. Firefox didn't seem to do anything with it. Chrome did, but honestly, the experience was better when it didn't — if there was a capture="" attribute, I couldn't see a way as a user to _not_ use the camera, whereas if there wasn't, I was given an intent selection dialog that allowed me to pick from several services including the camera.

I'm going to let this linger for a while longer to see where it goes.
Comment 13 Ian 'Hixie' Hickson 2014-09-29 22:00:12 UTC
As far as I can tell, Firefox and Chrome on Android work as follows:
 <input type=file> gives a dialog letting you pick the camera as an input source
 <input type=file accept="image/*"> same, but limits it to static photos
 <input type=file capture="camera"> does the same as the first
 <input type=file accept="image/*;capture=camera"> same as first
...so it seems to me that the conclusion is, this is not needed.
Comment 14 Tobie Langel 2014-09-30 08:53:47 UTC
(In reply to Ian 'Hixie' Hickson from comment #13)
> ...so it seems to me that the conclusion is, this is not needed.

Right, developers have chosen to build native apps instead anyway so why bother.