简体   繁体   中英

Photo capture with Windows Phone 8.1 and JavaScript

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM