-
-
Save polatengin/647b7a895e8b0f06daa4a37935d45c78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows 10 UWP uygulamalarında ön veya arka kamera'nın görüntüsünü almak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var camera = videoDevices.FirstOrDefault(item => item.EnclosureLocation != null && item.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override async void OnNavigatedTo(NavigationEventArgs e) | |
{ | |
var videoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture); | |
var camera = videoDevices.FirstOrDefault(item => item.EnclosureLocation != null && item.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Front); | |
if (camera != null) | |
{ | |
var captureSettings = new MediaCaptureInitializationSettings { VideoDeviceId = camera.Id }; | |
var mediaCapture = new MediaCapture(); | |
await mediaCapture.InitializeAsync(captureSettings); | |
CameraCaptureElement.Source = mediaCapture; | |
await mediaCapture.StartPreviewAsync(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page | |
x:Class="SelectFrontOrBackCamera.MainPage" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="using:SelectFrontOrBackCamera"> | |
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | |
<CaptureElement x:Name="CameraCaptureElement" /> | |
</Grid> | |
</Page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment