public static async Task <MediaCaptureJob> CreateCaptureToFileJobAsync(MediaCapture captureManager) { // Save type options var wmvFileSaveType = new KeyValuePair <String, IList <String> >("Windows Media", new List <String> { MediaCaptureJob.WindowsMediaExtension }); var mp4FileSaveType = new KeyValuePair <String, IList <String> >("MP4", new List <String> { MediaCaptureJob.Mp4Extension }); // Get the file to save var savePicker = new FileSavePicker { SuggestedStartLocation = PickerLocationId.VideosLibrary, SuggestedFileName = "Video Capture" }; savePicker.FileTypeChoices.Add(wmvFileSaveType); savePicker.FileTypeChoices.Add(mp4FileSaveType); var fileToSaveTo = await savePicker.PickSaveFileAsync(); if (fileToSaveTo == null) { return(null); } var mediaCaptureJob = new MediaCaptureJob(captureManager, fileToSaveTo); return(mediaCaptureJob); }
private async void StartCapture() { // Clear out any previous capture job _currentCaptureJob = null; // Start a new capture job var captureJob = await _mediaCaptureHelper.StartCaptureAsync(); if (captureJob != null) { IsCapturing = true; _currentCaptureJob = captureJob; } }
public async Task <MediaCaptureJob> StartCaptureAsync() { if (_captureManager == null) { throw new InvalidOperationException("Capture Manager has not been initialized."); } var captureJob = await MediaCaptureJob.CreateCaptureToFileJobAsync(_captureManager); if (captureJob != null) { captureJob.StartCaptureAsync(VideoQualityToUse); } return(captureJob); }