本文整理汇总了C#中Windows.Media.Capture.MediaCapture.SetRecordRotation方法的典型用法代码示例。如果您正苦于以下问题:C# MediaCapture.SetRecordRotation方法的具体用法?C# MediaCapture.SetRecordRotation怎么用?C# MediaCapture.SetRecordRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.Media.Capture.MediaCapture
的用法示例。
在下文中一共展示了MediaCapture.SetRecordRotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: This_Loaded
private async void This_Loaded( object sender, RoutedEventArgs e )
{
try
{
_camera = new MediaCapture();
await _camera.InitializeAsync( new MediaCaptureInitializationSettings
{
VideoDeviceId = ( await GetBackCameraAsync() ).Id,
StreamingCaptureMode = StreamingCaptureMode.Video,
PhotoCaptureSource = PhotoCaptureSource.VideoPreview
} );
_camera.VideoDeviceController.FlashControl.Enabled = false;
_camera.SetPreviewRotation( VideoRotation.Clockwise90Degrees );
_camera.SetRecordRotation( VideoRotation.Clockwise90Degrees );
CameraPreview.Source = _camera;
await _camera.StartPreviewAsync();
StartScanning();
}
catch
{
ErrorMessage.Visibility = Visibility.Visible;
}
}
示例2: initCamera
private async void initCamera()
{
if (camera == null)
{
camera = new MediaCapture();
await camera.InitializeAsync();
camera.SetPreviewRotation(VideoRotation.Clockwise270Degrees);
camera.SetRecordRotation(VideoRotation.Clockwise270Degrees);
}
CameraPreview.Source = camera;
await camera.StartPreviewAsync();
}
示例3: SwitchCameras
private async Task SwitchCameras(object sender, RoutedEventArgs e)
{
await mediaCaptureMgr.StopPreviewAsync();
mediaCaptureMgr.Dispose();
mediaCaptureMgr = null;
mediaCaptureMgr = new MediaCapture();
if (isUsingFrontCam)
{
await mediaCaptureMgr.InitializeAsync(new MediaCaptureInitializationSettings { VideoDeviceId = rearCam.Id });
mediaCaptureMgr.SetRecordRotation(VideoRotation.Clockwise90Degrees);
mediaCaptureMgr.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
}
else
{
await mediaCaptureMgr.InitializeAsync(new MediaCaptureInitializationSettings { VideoDeviceId = frontCam.Id });
mediaCaptureMgr.SetRecordRotation(VideoRotation.Clockwise270Degrees);
mediaCaptureMgr.SetPreviewRotation(VideoRotation.Clockwise270Degrees);
}
isUsingFrontCam = !isUsingFrontCam;
StartPreview();
}
示例4: CaptureImage
private async Task CaptureImage()
{
cameraCapture = new MediaCapture();
cameraCapture.Failed += cameraCapture_Failed;
await cameraCapture.InitializeAsync();
#if WINDOWS_PHONE_APP
cameraCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
cameraCapture.SetRecordRotation(VideoRotation.Clockwise90Degrees);
#endif
captureGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;
previewElement.Visibility = Windows.UI.Xaml.Visibility.Visible;
previewElement.Source = cameraCapture;
await cameraCapture.StartPreviewAsync();
}
示例5: InitializeQrCode
private async Task InitializeQrCode()
{
string error = null;
try
{
//if (_mediaCapture == null)
//{
// Find all available webcams
DeviceInformationCollection webcamList = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
// Get the proper webcam (default one)
DeviceInformation backWebcam = (from webcam in webcamList where webcam.IsEnabled && webcam.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back select webcam).FirstOrDefault();
// Initializing MediaCapture
_mediaCapture = new MediaCapture();
await _mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings
{
VideoDeviceId = backWebcam.Id,
AudioDeviceId = "",
StreamingCaptureMode = StreamingCaptureMode.Video,
PhotoCaptureSource = PhotoCaptureSource.VideoPreview
});
// Adjust camera rotation for Phone
_mediaCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
_mediaCapture.SetRecordRotation(VideoRotation.Clockwise90Degrees);
// Set the source of CaptureElement to MediaCapture
captureElement.Source = _mediaCapture;
await _mediaCapture.StartPreviewAsync();
//_mediaCapture.FocusChanged += _mediaCapture_FocusChanged;
// Seetting Focus & Flash(if Needed)
var torch = _mediaCapture.VideoDeviceController.TorchControl;
if (torch.Supported) torch.Enabled = true;
await _mediaCapture.VideoDeviceController.FocusControl.UnlockAsync();
var focusSettings = new FocusSettings();
focusSettings.AutoFocusRange = AutoFocusRange.FullRange;
focusSettings.Mode = FocusMode.Continuous;
focusSettings.WaitForFocus = true;
focusSettings.DisableDriverFallback = false;
_mediaCapture.VideoDeviceController.FocusControl.Configure(focusSettings);
await _mediaCapture.VideoDeviceController.FocusControl.FocusAsync();
//}
}
catch (Exception ex)
{
dialog = new MessageDialog("Error: " + ex.Message);
dialog.ShowAsync();
}
}