当前位置: 首页>>代码示例>>C#>>正文


C# MediaCapture.SetRecordRotation方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:ValentinMinder,项目名称:pocketcampus,代码行数:25,代码来源:CodeScanView.xaml.cs

示例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();
        }
开发者ID:Benjin,项目名称:Selfie,代码行数:14,代码来源:MainPage.xaml.cs

示例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();
        }
开发者ID:Bharatvaj,项目名称:The-Doppler-Effect,代码行数:26,代码来源:RecordPage.xaml.cs

示例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();
        }
开发者ID:cealmees,项目名称:Appdoptame,代码行数:18,代码来源:MainPage.xaml.cs

示例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();
            }
        }
开发者ID:amasolini,项目名称:brid-wp,代码行数:66,代码来源:QRScanner.xaml.cs


注:本文中的Windows.Media.Capture.MediaCapture.SetRecordRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。