private void StartRecording() { if (!cameraLoaded || !cameraConnected || recording) { return; } string root; string subdir; if (index == 0) { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoSubdir; } else { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoSubdir; } string filenameWithoutExtension = view.CurrentVideoFilename; string extension = Filenamer.GetVideoFileExtension(); Dictionary <FilePatternContexts, string> context = BuildCaptureContext(); string path = Filenamer.GetFilePath(root, subdir, filenameWithoutExtension, extension, context); FilesystemHelper.CreateDirectory(path); if (!FilePathSanityCheck(path)) { return; } if (!OverwriteCheck(path)) { return; } if (consumerRecord.Active) { consumerRecord.Deactivate(); } if (recordingThumbnail != null) { recordingThumbnail.Dispose(); recordingThumbnail = null; } double interval = cameraGrabber.Framerate > 0 ? 1000.0 / cameraGrabber.Framerate : 40; SaveResult result = pipelineManager.StartRecord(path, interval); recording = result == SaveResult.Success; if (recording) { recordingStart = DateTime.Now; view.UpdateRecordingStatus(recording); view.Toast(ScreenManagerLang.Toast_StartRecord, 1000); } else { //DisplayError(result); } }
public void StopRecord() { consumerRecord.Deactivate(); }