SetEncoderProperty() public method

public SetEncoderProperty ( [ mediaStreamType, [ propertyId, [ propertyValue ) : void
mediaStreamType [
propertyId [
propertyValue [
return void
Ejemplo n.º 1
0
        private async Task StartPreviewAsync()
        {
            try
            {
                m_mediaCapture = new MediaCapture();

                m_mediaCapture.Failed += OnMediaCaptureFailed;

                _displayRequest.RequestActive();

                // Populate orientation variables with the current state
                m_displayOrientation = m_displayInformation.CurrentOrientation;

                RegisterEventHandlers();
                
                var devInfo = await FindCameraDeviceByPanelAsync(m_desiredCameraPanel);
                var id = devInfo != null ? devInfo.Id : string.Empty;

                var settings = new MediaCaptureInitializationSettings();
                settings.VideoDeviceId = id;
                settings.MediaCategory = MediaCategory.Communications;

                await m_mediaCapture.InitializeAsync(settings);

                m_mediaCapture.SetEncoderProperty(MediaStreamType.VideoPreview, 
                    new Guid("9C27891A-ED7A-40e1-88E8-B22727A024EE"), PropertyValue.CreateUInt32(1));

                var resolutionMax = GetHighestResolution();

                ImageWidth = resolutionMax.Width;
                ImageHeight = resolutionMax.Height;

                await m_mediaCapture.VideoDeviceController.SetMediaStreamPropertiesAsync
                    (MediaStreamType.VideoPreview, resolutionMax);

                m_PreviewVideoElement.Source = m_mediaCapture;
                await AddEffectsAsync();

                await m_mediaCapture.StartPreviewAsync();

                await SetPreviewRotationAsync();

                IsCaptureEnabled = true;

                UpdateButtonState();

            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }