RE: Re: Re: Proposed resolution for open items

I certainly like the idea of an API that engages the devices "camera/photo" mode, versus, just capturing a snapshot of the video stream.

The JavaScript WinRT MediaCapture object in Windows 8 has a similar API: http://msdn.microsoft.com/en-us/library/windows/apps/hh700836.aspx, exposed just for this use case.


>-----Original Message-----
>From: Randell Jesup [mailto:randell-ietf@jesup.org]
>Sent: Tuesday, May 15, 2012 12:12 AM
>To: public-media-capture@w3.org
>Subject: Fwd: Re: Re: Proposed resolution for open items
>
>Regarding the "simple capture API":
>
>Robert O'Callahan had indicated he'd propose an alternative.  Here's a
>possibility he came up with.  Note as he mentions we've already landed
>in Mozilla nightlies media_element.src = stream.   Note that this would
>NOT work well with createObjectURL, especially if the "avoids leaks
>better" option for a single use is in play.  (It's retrieving the
>mediastream from media_element.src.)  To work at all with
>URL.createObjectURL there would need to be a URL.objectFromURL or some
>equivalent.  (Another example of why .src = stream is a good idea, and
>createObjectURL is clumsy.)
>
>   Randell
>
>This is about an app grabbing a preview stream and then, when the user
>presses a "take photo" button, firing the flash and grabbing a high-res
>snapshot, right? Here's a thought experiment:
>
><video id="preview" onclick="takePhoto(event)"></video>
><script>
>function onsuccess(stream) {
>   document.getElementById("preview").src = stream;
>}
>function blobCallback(blob) {
>   // This blob contains the image data; do whatever needs to be done
>with it
>}
>function takePhoto(event) {
>   var stream = event.target.src;
>   var videoTrack = stream.videoTracks[0];
>   videoTrack.takeSnapshot({}, blobCallback);
>}
>navigator.getUserMedia({video:true}, onsuccess);
></script>
>
>Apart from allowing HTMLMediaElement.src to be a MediaStream (already on
>mozilla-central!), the only new API here a VideoMediaStreamTrack
>subclass of MediaStreamTrack, with a takeSnapshot method on it. I've
>given that method a blob callback to asynchronously return the snapshot
>image, and an options object. By default I think the snapshot should
>autofocus, autoflash, etc, but you could provide options to override all
>of those things. I'm not enough of a domain expert to say what all those
>options should be. By default, takeSnapshot should obtain the best
>quality and highest-resolution image the hardware can provide.
>
>Rob
>

Received on Tuesday, 15 May 2012 17:32:40 UTC