mardi 24 février 2015

How to initialize the camera correctly in Windows 8?

I am trying to initialize the camera on windows 8. I have enabled the webcam capability in the project and on my windows 8 device as well.


Here is my code:



var dialog = new Windows.Media.Capture.CameraCaptureUI();
var aspectRatio = { width: 1, height: 1 };

dialog.photoSettings.croppedAspectRatio = aspectRatio;
dialog.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).done(function (file) {
if (file) {
editPreviewPicture(file);
mainApp.pictureAccept('control');
} else {

}
}, function (e) {
console.log("Error while opening camera: ", e);
});


On the line with 'captureFileAsync' I get the following error:



Runtime-error JavaScript: Access Denied.



I have double checked everything that is needed, even downloaded the sample project to check the code and test the camera, everything worked fine in that project.


Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire