- From: Mandyam, Giridhar <mandyam@qti.qualcomm.com>
- Date: Sat, 30 Jan 2016 23:44:20 +0000
- To: "public-media-capture@w3.org" <public-media-capture@w3.org>
I am still editing the spec, but I was hoping for feedback from implementers. So far there are intents-to-implement in both Chrome and Mozilla but not much else. See https://lists.w3.org/Archives/Public/public-media-capture/2015Nov/0024.html for my latest update on the spec to the mailing list. If you think there are errors with the example code, then I'd be happy to fix them in the specification. But it seems that the primary concern that you have expressed is with the use of promises rather than callbacks. This topic was discussed on the mailing lists and in F2F meetings, and the promise-based approach seemed to have been blessed by this group. Note that in the absence of ImageCapture, there is the declarative capture spec HTML Media Capture (https://www.w3.org/TR/html-media-capture/). Support is fairly widespread amongst mobile browsers - see http://mobilehtml5.org/ for example. -Giri Mandyam -----Original Message----- From: Garrett Smith [mailto:dhtmlkitchen@gmail.com] Sent: Saturday, January 30, 2016 12:55 PM To: public-media-capture@w3.org Subject: Image Capture What's the recommend approach for taking photos in the browser? Is the image capture API dead? The code is squashed up onto one line. See:— http://w3c.github.io/mediacapture-image/#taking-a-picture-if-red-eye-reduction-is-activated navigator.getUserMedia({video: true}, gotMedia, failedToGetMedia); function gotMedia(mediastream) { //Extract video track. var videoDevice = mediastream.getVideoTracks()[0]; // Check if this device supports a picture mode... var captureDevice = new ImageCapture(videoDevice); if (captureDevice) { if (captureDevice.photoCapabilities.redEyeReduction) { captureDevice.setOptions({redEyeReductionSetting:true}).then(captureDevice.takePhoto().then(showPicture(blob),function(error){alert("Failed to take photo");})); } else console.log('No red eye reduction'); } } function showPicture(e) { var img = document.querySelector("img"); img.src = URL.createObjectURL(e.data); } function failedToGetMedia{ console.log('Stream failure'); } I see an incomplete example with a line that looks well over 150 chars wide, an unclosed function, console.log statements, and continuation of the promises trend as realized in the API. And it will still throw errors even if the SyntaxErrors are cleaned up. Slow, buggy wrapper libraries should not be used to save developers from the n complexity of browser implementations over APIs. Instead, APIs should be designed so that libraries are not needed. Can taking a photo require a low degree of complexity? E.g. a method call with a callback and an error handler. How does it work? Thank you, -- Garrett @xkit ChordCycles.wordpress.com garretts.github.io personx.tumblr.com
Received on Saturday, 30 January 2016 23:44:54 UTC