JSFoo 2014

JavaScript as the centerpiece of a complex web stack

Using javascript to access Camera functions

Submitted by D.Vigneshwer on Friday, 13 June 2014

videocam_off

Technical level

Intermediate

Section

Full talk

Status

Submitted

Vote on this proposal

Login to vote

Total votes:  0

Objective

Using javascript to access Camera functions

This topic shows you the simplest way to capture a photo or video from your embedded or attached camera, by using the JS. This project will launche a full-screen dialog that presents a camera UI, and enables you to capture a photo or video with as little as one method call.

Objective: Capture a photo or video from a webcam.

Description

simple description
1. Open Visual Studio

Open an instance of Visual Studio.
2. Create a new project

In the New Project dialog box, choose a blank application from the JavaScript project types.
3. Insert the app JavaScript and HTML

Open your file Default.html and copy the following HTML into this file (replacing its original contents).

courtesy : msdn
but this is the best description i can give

<!DOCTYPE html>
<html>
<head>
<title>WinWebApp1</title> <!-- WinJS references --> <link rel="stylesheet" href="/winjs/css/ui-dark.css" /> <script src="/winjs/js/base.js"></script> <script src="/winjs/js/wwaapp.js"></script> <!-- WinWebApp1 references --> <link rel="stylesheet" href="/css/default.css" />

<script type = "text/javascript" >

// Takes a photo using the default JPEG format. function takepicture() { var captureUI = new Windows.Media.Capture.CameraCaptureUI(); captureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (capturedItem) { if (capturedItem) { document.getElementById("message").innerHTML = "User captured a photo." } else { document.getElementById("message").innerHTML = "User didn't capture a photo." } }); } </script> </head>
<body>
<input type="button" onclick="takepicture()" value="Take a Picture" /><br /> <span id="message"></span> </body>
</html>

Speaker bio

I am Vigneshwer Dhinakaran presently studying 3rd year in ECE at rajagiri college, ernakulam and also a founder of a startup company altroid. To be short and sweet I am an Innovative Engineer with an artistic perception of technology. I hold sun certified certificates on core java and J2EE .Have developed around 6 apps in various platforms ,and created around 10 websites. I have been as speaker and participant in various paper presentation competitons ,IEEE conferences ,pitching session at startup village and have taken workshops in web and app development for Rset ieee club .I am a active mozillian from mozilla kerala and have been involved in various mozilla activities & project contributions.

detailed session presentation will be drafted if selected.

Comments

  • 1
    Kaustav Das Modak (@kaustavdm) 4 years ago

    Is this platform-specific?

Login with Twitter or Google to leave a comment