示例#1
0
        private async void newvideoBtn_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                // Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
                CameraCaptureUI dialog = new CameraCaptureUI();
                dialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

                StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Video);

                if (file != null)
                {
                    IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);

                    CapturedVideo.SetSource(fileStream, "video/mp4");

                    // Store the file path in Application Data
                    // Each time you Capture a video file.Path is a different, randomly generated path.
                    appSettings[videoKey] = file.Path;
                    filePath = file.Path;       // Set the global variable so when you record a video, that's that video that will send
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        /// <summary>
        /// This is the click handler for the 'CaptureButton' button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CaptureVideo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                rootPage.NotifyUser("", NotifyType.StatusMessage);

                // Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
                CameraCaptureUI dialog = new CameraCaptureUI();
                dialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

                StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Video);

                if (file != null)
                {
                    IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);

                    CapturedVideo.SetSource(fileStream, "video/mp4");
                    ResetButton.Visibility = Visibility.Visible;

                    // Store the file path in Application Data
                    appSettings[videoKey] = file.Path;
                }
                else
                {
                    rootPage.NotifyUser("No video captured.", NotifyType.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(ex.Message, NotifyType.ErrorMessage);
            }
        }
        private async void VideoButton_Click(object sender, RoutedEventArgs e)
        {
            CameraCaptureUI dialog = new CameraCaptureUI();

            dialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;
            StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Video);

            StorageFile fileCopy = await file.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder);

            if (file != null)
            {
                IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read);

                CapturedVideo.SetSource(fileStream, "video/mp4");
            }
            var camVideo = new Images
            {
                Temp1 = file,
            };
            var camVideoFile = camVideo.Temp1;

            camVideo.Name = camVideoFile.Name;
            camVideo.ID   = ++camlastVideoID;
            FileHelper.WriteImagesToFileAsync(camVideo, FILE_NAME);
        }
示例#4
0
        /// <summary>
        /// Loads the video from file path
        /// </summary>
        /// <param name="filePath">The path to load the video from</param>
        private async Task ReloadVideo(String filePath)
        {
            try
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(filePath);

                IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

                // TODO: Figure out how to resume a paused video
                CapturedVideo.SetSource(fileStream, "video/mp4");
            }
            catch (Exception ex)
            {
                //appSettings.Remove(videoKey);
            }
        }
示例#5
0
        /// <summary>
        /// Loads the video from file path
        /// </summary>
        /// <param name="filePath">The path to load the video from</param>
        private async Task ReloadVideo(String filePath)
        {
            try
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(filePath);

                IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

                CapturedVideo.SetSource(fileStream, "video/mp4");
                ResetButton.Visibility = Visibility.Visible;
                rootPage.NotifyUser("", NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                appSettings.Remove(videoKey);
                rootPage.NotifyUser(ex.Message, NotifyType.ErrorMessage);
            }
        }
示例#6
0
 private void pauseBtn_Click_1(object sender, RoutedEventArgs e)
 {
     CapturedVideo.Pause();
 }
示例#7
0
 private void stopBtn_Click_1(object sender, RoutedEventArgs e)
 {
     CapturedVideo.Stop();
 }
 public RecordingDestinationDialog(CapturedVideo capturedVideo, Score score)
 {
 }