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 9619 - HTML Device Spec - Could Use More Example Code
Summary: HTML Device Spec - Could Use More Example Code
Status: CLOSED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-29 16:01 UTC by Mark Smith
Modified: 2012-07-18 18:40 UTC (History)
3 users (show)

See Also:


Attachments

Description Mark Smith 2010-04-29 16:01:12 UTC
Looking at the HTML Device Spec, Editor's Draft 26 April 2010 (http://dev.w3.org/html5/html-device/) it's quite difficult to figure out how to use the API to interact with streaming video from a web cam.

As far as I can tell, the API currently supports the following use case:

Display a Web Cam's Video Stream in a Video Tag:
1) Declare a device tag of type media
2) Specify an onchange event handler for the tag
3) When invoked, the change handler is passed a Stream object, which provides a url and a record() method
4) Set the url as the src attribute of the video tag, with the video tag then taking care of retrieving the video from this url and decoding it.

However, I don't see how you would take the contents of the stream using the File API and do preprocessing on it before passing it to a video tag or canvas.  For example, if you wanted to do the same as this
https://developer.mozilla.org/En/Manipulating_video_using_canvas
but without playing the original video in a video tag first.

The record() method on the stream only gives a StreamRecorder which (as far as I can tell), only gives you a File after calling stop() on it, ending the stream.  This isn't helpful, since you want to continue processing the stream live, rather than just grabbing recordings from it and processing them.  Are you supposed to be get a File from the Stream's url?

Here's my use case
Display a Modified Video Stream:
1) Declare a device tag of type media
2) Get a Stream from onchange
3) Open a File from the Stream's url (?)
4) Processes the data from the stream in javascript using a FileStream object (render to canvas?)
5) Render the modified stream either to a canvas or pipe it to a new File for display in a Video tag.

Feel free to shoot me down if this is way off for what the spec is intended to support, I was just curious to see how far the boundaries could be pushed.  I know that the spec is still at a very early stage, but I was considering trying to mock up an implementation with a web cam's byte stream being passed from Flash using the Flash-ajax bridge.
Comment 1 Ian 'Hixie' Hickson 2010-08-24 19:59:14 UTC
Marking this REMIND for now; work on <device> is awaiting much more in-depth network-side work first.
Comment 2 Ian 'Hixie' Hickson 2011-05-09 23:12:59 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: I added some examples as part of the semi-recent changes.
Comment 3 Mark Smith 2011-05-10 18:57:21 UTC
(In reply to comment #2)
> EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
> satisfied with this response, please change the state of this bug to CLOSED. If
> you have additional information and would like the editor to reconsider, please
> reopen this bug. If you would like to escalate the issue to the full HTML
> Working Group, please add the TrackerRequest keyword to this bug, and suggest
> title and text for the tracker issue; or you may create a tracker issue
> yourself, if you are able to do so. For more details, see this document:
>    http://dev.w3.org/html5/decision-policy/decision-policy.html
> 
> Status: Accepted
> Change Description: see diff given below
> Rationale: I added some examples as part of the semi-recent changes.

I wasn't able to see the diff you mention, but the photo booth example in section 9.3 is very helpful, thank you.