- From: Robin Berjon <robin@robineko.com>
- Date: Wed, 2 Dec 2009 12:53:33 +0100
- To: Dominique Hazael-Massieux <dom@w3.org>
- Cc: public-device-apis <public-device-apis@w3.org>
On Dec 2, 2009, at 11:45 , Dominique Hazael-Massieux wrote: > Le mercredi 02 décembre 2009 à 12:27 +0200, Ilkka Oksanen a écrit : >> I think viewfinder can be problematic feature for v1. Significant >> integration is needed between web rendering engine and native camera >> application/API in the host device. Additionally I believe that not all >> platforms have native APIs to stream live viewfinder image. Therefore as >> far I know for example PhoneGap is providing only launcher type of >> camera API. In that sense situation is similar to Contacts API and its >> searching functionality. Any comments? > > Ideally, the API would allow a browser to use either approaches; if > that’s not practical (and I can imagine reasons why it wouldn’t be), I > think we need to be careful in looking at what an embedded-viewfinder > API would look like, to see what forward-compatible designs we need to > come up with. Just off the top of my head, I think this would work: interface Capture { ... PendingOp viewFinder(in ViewFinderCB successCB, in ErrorCB errorCB); }; [FunctionOnly, NoInterfaceObject] interface ViewFinderCB { void onSuccess(in ViewFinder vf); }; [NoInterfaceObject] interface ViewFinder { readonly attribute DOMString URL; MediaData captureImage(); void startVideoCapture(); MediaData stopVideoCapture(); }; (The above is modelled on the File API, or at least on discussions around what it should look like). You'd then go: navigator.device.viewFinder(function (vf) { document.getElementById("my-video").src = vf.URL; }); That would give you a viewfinder. You then have some buttons that can call start/stop on the vf object you have squirrelled away somewhere (since the viewfinder was requested, and since one can always capture data from a video element, there is no extra security involved). Similar stuff can be built for <audio> and sound capture. Note that I'm not proposing that we add the above to the current draft. -- Robin Berjon robineko — hired gun, higher standards http://robineko.com/
Received on Wednesday, 2 December 2009 11:54:12 UTC