W3C home > Mailing lists > Public > public-device-apis@w3.org > December 2009

Re: <input type=photo> etc as Capture API

From: Robin Berjon <robin@robineko.com>
Date: Fri, 4 Dec 2009 12:26:09 +0100
Cc: ext Arve Bersvendsen <arveb@opera.com>, "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-Id: <311F1147-2EFE-495E-BEC6-F90491CDE107@robineko.com>
To: Ilkka Oksanen <Ilkka.Oksanen@nokia.com>
On Dec 3, 2009, at 12:57 , Ilkka Oksanen wrote:
> How much more complex would equivalent <input> based solution be?

There's too much hand-waving in this thread :) Let's write some code!

Here's an input based approach that (assuming the click event can be synthesised in this runtime), it's off the top of my head, may contain errors:

"""
function getVideo (sucCB) {
    var inp = document.createElement("input");
    inp.type = "file";
    inp.accept = "video/*";
    inp.onchange = function () { sucCB(this.files[0]); };
    inp.click();
}

function processVideo (file) {
    document.getElementById("my-video").src = file.URL;
}

getVideo(processVideo);
"""

(The above is just to try to ground the discussion.)

The code is simple enough, and typical enough, but my concern is whether this approach can scale to controlling the video. So in the above I've embedded the captured video in the page, but this assumes that it's already been recorded. How do I grow that into something that could stream it (streaming is hard enough already, I'm not sure how it marries to the form metaphor)? How do I grow that into something using which I could control the capture from within the document?

--
Robin Berjon
  robineko  hired gun, higher standards
  http://robineko.com/
Received on Friday, 4 December 2009 11:26:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:14:02 GMT