Camera input tag

Earlier this month I spent some time working on exposing camera functionality to content in fennec and firefox. First, I built upon Chris Double’s implementation of a GStreamer back end for the video tag and extended it to support a “camera://” protocol. When the video tag encounters this, it creates a GStreamer pipeline starting from a video for linux 2 source (v4l2).

This currently works on desktop linux that have a v4l2 supported camera (such as iSight) and the n800/n810. It will need to be implemented on mac and windows and configurations will need to be stored in preferences (in case you have multiple cameras or your camera uses a difference interface).

Next I wrapped a video tag, image and a few buttons in xbl and bound it to <input type=”camera” />. When a user hits a website using this tag, he or she currently will see a live video preview and a “take photo” button. When the user clicks the button, the photo is grabbed from the camera and shown to the user in the image element. The image element and video element are in a deck element so only one is shown at a time. After the photo is taken, there is a button that reads “Take another photo,” in case the user doesn’t like the one they just took. Once the user is satisfied, this element works like any other form element and the file can be uploaded to a web service.

After talking to a few people this should acutally be bound to <input type=”file” accept=”image/png”/>. Also, it needs some UI design both for what it looks like in content and for a configuration dialog. Finally, we’ll need to think about security and make sure no one can snap a photo of you when you’re not looking your best. Speaking of which, I might as well share:

Camera Input tag

I’ve notice quite a few iPhone apps that allow users to take a photo and upload it with out leaving the application. Absent the ability to do this from the web, these otherwise web centric services have been forced to write a native application to accomplish their goal. Hopefully this will eventually help web services stay on the web.

The Buzz {1 trackbacks/pingbacks}

  1. Pingback: camera:// | Robert Accettura’s Fun With Wordage on September 24, 2008

The Conversation {16 comments}

  1. Christopher Blizzard {Tuesday September 23, 2008 @ 2:20 pm}

    This is your Meme(me) photo, clearly.

  2. Tom {Tuesday September 23, 2008 @ 3:05 pm}

    why not just cam:// or would that be a bit too voyeurish?

  3. –disable {Tuesday September 23, 2008 @ 3:12 pm}

    Mozilla, bringing the surveillance state into your home:P

    As the Dr Pepper commercials in the UK ask, “what’s the worst that could happen”?

  4. sonny {Tuesday September 23, 2008 @ 3:53 pm}

    nice work

  5. Aza Raskin {Tuesday September 23, 2008 @ 3:56 pm}

    This is excellent. Especially with the new work Vlad and Roc have done with SVG transforms, this will be lots of fun.

  6. xeen {Tuesday September 23, 2008 @ 6:40 pm}

    I wonder if it’s possible to abuse this the same way like the old IE “trick” with an iframe that points to C:\. The “trick” is very cheap, but nevertheless scares non-technical people.

  7. Chris {Wednesday September 24, 2008 @ 3:36 am}

    fantastic news!

    The obvious next steps are and . Imagining submitting an audio search to Google by talking to your phone, or using your browser as a webcam!

  8. Chris {Wednesday September 24, 2008 @ 3:48 am}

    stupid HTML stripping! What I refer to above are <input type=”file” accept=”audio/*”/> and <input type=”file” accept=”video/*”/>.

  9. John Drinkwater {Wednesday September 24, 2008 @ 4:03 am}

    Please make sure that this can not be enabled without the user knowing. Having a remote web site ‘steal’ photos of people would be really scary to contemplate.

    Please make sure it’s accessible to JavaScript for Canvas usage; being able to add ‘filters’ (like Cheese on Linux) is something I could see a little ecosystem of avatar tools would want.

  10. Fowl {Thursday September 25, 2008 @ 1:04 am}

    Don’t forget audio and video…

    (oh, and pixel shaders… definitely we /need/ pixel shaders…)

  11. quodlibetor {Thursday September 25, 2008 @ 1:18 am}

    hey!!!

    microphone:// and <input type=”mic(rophone)”> are absolutely required, as well.

    :-)

  12. quodlibetor {Thursday September 25, 2008 @ 1:18 am}

    oops: <input type=”mic(rophone)”>

  13. pd {Thursday September 25, 2008 @ 9:47 am}

    <video type=”camera”> makes more sense doesn’t it?

  14. Ryan Jones {Thursday September 25, 2008 @ 9:58 am}

    Personally I think that adding these as extensions to the video and audio elements respectively would be more useful in the long run as they are in face video and audio related.

    The idea seems really promising and could help build another bridge between interfacing the operating system functionality from the web. It’s a brilliant idea actually.

  15. Facundo Cabrera {Friday September 26, 2008 @ 10:32 am}

    Where can I download the code ?

    I’m very interesting in use this functionaly in my web browser and create a video in a remote server, always without use flash :D

    Excelente job !!!

  16. CHARGER for Minolta NP-200 {Thursday January 22, 2009 @ 8:12 am}

    AWESOME!That’s great.

Sorry, comments for this entry are closed at this time.