We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am not able to see preview of video device on specific machine. But I am able to get the resolutions and take the screenshot from the video device.
Below is the code snippet to show preview from selected video device.
**DeviceInformation selectedDevice = Devices.SelectedItem as DeviceInformation;
if (preview != null) { await preview.StopAsync(); Preview.Source = null; preview = null; } var settings = new MediaCaptureInitializationSettings(); settings.AudioDeviceId = ""; settings.VideoDeviceId = selectedDevice.Id; settings.StreamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.Video; capture = new MediaCapture(); await capture.InitializeAsync(); preview = new CapturePreview(capture); Preview.Source = preview; await preview.StartAsync(); PopulateComboBox(MediaStreamType.Photo, Resolutions, true);**
Here is the code snippet to take screenshot.
**try { ImageEncodingProperties format = ImageEncodingProperties.CreatePng(); //generate file in local folder: StorageFile capturefile; StorageFolder folder = KnownFolders.SavedPictures; capturefile = await folder.CreateFileAsync("photo_" + DateTime.Now.Ticks.ToString() + ".png", CreationCollisionOption.ReplaceExisting); //take & save photo await capture.CapturePhotoToStorageFileAsync(format, capturefile); //show captured photo
if (!Directory.Exists(@"C:\Exports\CameraCaptures\")) { Directory.CreateDirectory(@"C:\Exports\CameraCaptures\"); } string filePath = @"C:\Exports\CameraCaptures\" + Path.GetFileName(capturefile.Path); File.Copy(capturefile.Path, filePath); BitmapImage img = new BitmapImage(new Uri(filePath, UriKind.RelativeOrAbsolute)); Captured.Source = img; Captured.Visibility = Visibility.Visible; Preview.Visibility = Visibility.Collapsed; await capturefile.DeleteAsync(StorageDeleteOption.PermanentDelete); } catch (Exception ex) { LogHelper.WriteException(ex); }**
Please find configuration of the machine shown in the image.
machine
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am not able to see preview of video device on specific machine.
But I am able to get the resolutions and take the screenshot from the video device.
Below is the code snippet to show preview from selected video device.
**DeviceInformation selectedDevice = Devices.SelectedItem as DeviceInformation;
Here is the code snippet to take screenshot.
**try
{
ImageEncodingProperties format = ImageEncodingProperties.CreatePng();
//generate file in local folder:
StorageFile capturefile;
StorageFolder folder = KnownFolders.SavedPictures;
capturefile = await folder.CreateFileAsync("photo_" + DateTime.Now.Ticks.ToString() + ".png", CreationCollisionOption.ReplaceExisting);
//take & save photo
await capture.CapturePhotoToStorageFileAsync(format, capturefile);
//show captured photo
Please find configuration of the
machine
shown in the image.The text was updated successfully, but these errors were encountered: