Let’s see the steps.
Create new windows 10 universal app using javascript. For creating a new Windows 10 universal project, refer to the following:
We need to enable the capability “Webcam" in the Package.appx manifest file as in the following image.

Next we need to add a button to capture Image and an Image control to show the captured image.
Go to default.html page and write the following code.
- <input type="button" id="btnCapture" value="Capture"
- onclick="captureImage()" />
- <img id="imgCapture" src="" width="100px" height="100px" />
- var page = WinJS.UI.Pages.define("default.html",
- {
- ready: function (element, options) {
- document.getElementById("btnCapture").addEventListener("click", captureImage, false);
- },
- });
- function captureImage() {
- var cam = Windows.Media.Capture.CameraCaptureUI();
- cam.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo)
- .done(function (data) {
- if (data) {
- document.getElementById('imgCapture').src
- = window.URL.createObjectURL(data);
- }
- }
- , error);
- }
- function error() {
- alert('Error');
- }
Now run the app and output can be seen like the following screen:

For more information on Windows 10 UWP, refer to my e-book:


Vignesh ManiTOP 100Posted Apr 24, 2016, 6:24 AM EDT
Nice
Humayun Kabir MamunPosted Apr 23, 2016, 8:39 PM EDT
Nice...
Bhuvanesh MohankumarPosted Apr 23, 2016, 2:22 PM EDT
Good
Kishor Bikram OliPosted Apr 23, 2016, 8:27 AM EDT
nice. thanks for sharing
Debasis SahaTOP 100Posted Apr 23, 2016, 2:27 AM EDT
Nice One..
Gowtham RajamanickamTOP 100Posted Apr 22, 2016, 8:06 PM EDT
Good one...
NitinPosted Apr 22, 2016, 7:36 PM EDT
Good one
Vignesh ManiTOP 100Posted Apr 22, 2016, 1:35 PM EDT
Nice
Ankur MistryTOP 100Posted Apr 22, 2016, 8:33 AM EDT
Helpful stuff
Kuppurasu NagarajTOP 100Posted Apr 22, 2016, 8:02 AM EDT
Nice Sharing..
Gowtham RajamanickamTOP 100Posted Apr 22, 2016, 12:29 AM EDT
very good
Rahul Kumar SaxenaTOP 100Posted Apr 21, 2016, 9:28 PM EDT
Good show