Question

I am trying to capture a Picture within a Windows Phone 8.1 app and I saw a very promising answer here at stockoverflow: Photo capture on Windows Store App for Windows Phone

But I am developing with JavaScript and HTML. Unfortunately I can not find a solution within this environment. In the stackoverflow answer CaptureElement is mentioned but on the official site from Microsoft about the CaptureElement class one can read for javascript:

No code example is currently available or this language may not be supported.

How is it possible to take a picture with JavaScript? Thanks a lot for any ideas!

Cheers, Tim.

Was it helpful?

Solution

I finally know what the difference is. One link helped me a lot: MediaCapture.StartPreviewAsync is not available in javascript? There is a link mentioned pointing to a sample source code: Media capture using capture device sample. The most important part:

mediaCapture = new Windows.Media.Capture.MediaCapture();
mediaCapture.initializeAsync().done(function(result){
    var video = this.document.getElementById("PhotoPreview");
    video.src = URL.createObjectURL(mediaCapture, { oneTimeOnly: true });
    video.play();
})

Thanks to everyone reading my question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top