| 7 | var devices = require('windows.media.devices'); |
| 8 | |
| 9 | function captureImage(fileName) { |
| 10 | storage.KnownFolders.picturesLibrary.createFileAsync(fileName, |
| 11 | storage.CreationCollisionOption.replaceExisting, function (err, newFile) { |
| 12 | var storageFile = newFile; |
| 13 | if (err) { |
| 14 | return console.info('file', err); |
| 15 | } |
| 16 | capture.capturePhotoToStorageFileAsync(mp.ImageEncodingProperties.createJpeg(), storageFile, function (err, res) { |
| 17 | if (err) { |
| 18 | return console.info(err); |
| 19 | } |
| 20 | console.info('Image was succesfully saved to:', storageFile.path); |
| 21 | }); |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | var capture = new capture.MediaCapture(); |
| 26 | capture.initializeAsync(function (err, res) { |