Witam,
Piszę aplikacje na Windows 8.1 Streamuje obraz z camery do kontrolki CaptureElement chciałbym jednak żeby zapisywał się na dysku. Może ktoś nakierować mnie lub podać przykład jak zapisać video. Próbuję tak jak poniżej ale nic się nie zapisuje. Nie mam doświadczenia z programowaniem w C# w jakimś większym stopniu zwłaszcza na Windows 8 dlatego proszę o wyrozumiałość.

  

        private MediaCapture mediaCaptureMgr = null;
        private bool previewStarted = false;
       private CoreDispatcher dispatcher = Window.Current.Dispatcher;

        IStorageFile myFile;
        DeviceInformationCollection devices;


 private async void StartRecBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Check if the machine has a webcam
                devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
                if (devices.Count > 0)
                {
                    if (mediaCaptureMgr == null)
                    {

                        // Using Windows.Media.Capture.MediaCapture APIs to stream from webcam
                        mediaCaptureMgr = new MediaCapture();
                        await mediaCaptureMgr.InitializeAsync();

                        VideoStream.Source = mediaCaptureMgr;  ///VideoStram to moja kontrolka CaptureElement w XML. 
                        await mediaCaptureMgr.StartPreviewAsync();
                        IStorageFolder folder;
                        folder =KnownFolders.VideosLibrary;



                        MediaEncodingProfile encodingProfile;                        
                        encodingProfile = MediaEncodingProfile.CreateMp4(Auto);

                        await mediaCaptureMgr.StartRecordToStorageFileAsync(encodingProfile, myFile);
                        previewStarted = true;

                        ShowSettings.IsEnabled = true;
                        //ShowSettings.Visibility = Visibility.Visible;
                        // StartPreview.IsEnabled = false;
                    }
                }
                else
                {
                    //rootPage.NotifyUser("A webcam is required to run this sample.", NotifyType.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                mediaCaptureMgr = null;
                // rootPage.NotifyUser(ex.Message, NotifyType.ErrorMessage);
            }

            

        }
        private async void Stop_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                await mediaCaptureMgr.StopRecordAsync();
                
            }
            catch(Exception ex)
            {
                
            }

        }