private async void OnLoaded(object sender, RoutedEventArgs e)
        {
            _previewImageSource = new SoftwareBitmapSource();
            PreviewImage.Source = _previewImageSource;
            _cameraHelper       = new CameraHelper();

            IReadOnlyList <MediaFrameSourceGroup> frameSourceGroups = await CameraHelper.GetFrameSourceGroupsAsync();

            CameraHelperResult result = await _cameraHelper.InitializeAndStartCaptureAsync();

            if (result == CameraHelperResult.Success)
            {
                // Subscribe to the video frame as they arrive
                _cameraHelper.FrameArrived             += CameraHelper_FrameArrived;
                FrameSourceGroupCombo.ItemsSource       = frameSourceGroups;
                FrameSourceGroupCombo.SelectionChanged += FrameSourceGroupCombo_SelectionChanged;

                MediaFrameSource frameSource = _cameraHelper.PreviewFrameSource;
                _mediaPlayer = new MediaPlayer {
                    AutoPlay = true, RealTimePlayback = true
                };
                _mediaPlayer.Source = MediaSource.CreateFromMediaFrameSource(frameSource);
                MediaPlayerElementControl.SetMediaPlayer(_mediaPlayer);

                FrameSourceGroupCombo.SelectedIndex = 0;
            }
        }
        private async void FrameSourceGroupCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (FrameSourceGroupCombo.SelectedItem is MediaFrameSourceGroup selectedGroup)
            {
                _cameraHelper.FrameSourceGroup = selectedGroup;
                CameraHelperResult result = await _cameraHelper.InitializeAndStartCaptureAsync();

                MediaFrameSource frameSource = _cameraHelper.PreviewFrameSource;
                //_mediaPlayer = new MediaPlayer { AutoPlay = true, RealTimePlayback = true };
                _mediaPlayer.Source = MediaSource.CreateFromMediaFrameSource(frameSource);
                MediaPlayerElementControl.SetMediaPlayer(_mediaPlayer);
            }
        }