I\'m trying to implement an image capture via this API, and I need to implement in via desktop application.
The problem is that when I save the image into a file (with <
In order for your store app to interact with the Camera there are actually two ways, a simple one, and an advanced one:
if you just want to take a picture or a video from the
webcam, i suggest you use the first approach which mainly use the CameraCaptureUI
API, but if you need complete control over the capturing operation, you need some lines of codes that interact with the MediaCapture
APIs
here a simple example using the CameraCaptureUI API :
let say we have the following UI:
and here the capture button click handler:
private async void TakePicture_Click(object sender, RoutedEventArgs e)
{
var camera = new CameraCaptureUI();
var image = await camera.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (image != null)
{
var stream = await image.OpenAsync(FileAccessMode.Read);
var bitmap = new BitmapImage();
bitmap.SetSource(stream);
Picture.Source = bitmap;
}
else
{
(new MessageDialog("Something went wrong")).ShowAsync();
}
}
you need also to offer your app the permission to use the webcam by checking the Webcam capability in the App Manifest