private void btnStartStopRecording_Click(object sender, EventArgs e) { // Is it Recoring ? if (_bStartedRecording) { // Yes // Stops encoding _job.StopEncoding(); btnStartStopRecording.Text = "Start Recording"; toolStripStatusLabel1.Text = ""; _bStartedRecording = false; } else { // Sets up publishing format for file archival type FileArchivePublishFormat fileOut = new FileArchivePublishFormat(); // Sets file path and name fileOut.OutputFileName = String.Format("C:\\WebCam{0:yyyyMMdd_hhmmss}.wmv", DateTime.Now); // Adds the format to the job. You can add additional formats as well such as // Publishing streams or broadcasting from a port _job.PublishFormats.Add(fileOut); // Start encoding _job.StartEncoding(); btnStartStopRecording.Text = "Stop Recording"; toolStripStatusLabel1.Text = fileOut.OutputFileName; _bStartedRecording = true; } }
public void endVideoCapture() { job.StopEncoding(); job.RemoveDeviceSource(liveSource); //liveSource.Dispose(); //liveSource = null; //job.Dispose(); }
//zatrzymanie podgląu internal void Stop() { // Has the Job already been created ? if (_job != null) { _job.StopEncoding(); _job.RemoveDeviceSource(_deviceSource); _deviceSource.PreviewWindow = null; _deviceSource = null; } }
private string VideoCapture(Collection <EncoderDevice> Vdevices) { // Starts new job for preview window LiveJob _job = new LiveJob(); // Create a new device source. We use the first audio and video devices on the system LiveDeviceSource _deviceSource = _job.AddDeviceSource(Vdevices[0], null); // Make this source the active one _job.ActivateSource(_deviceSource); FileArchivePublishFormat fileOut = new FileArchivePublishFormat(); // Sets file path and name string path = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); string output = String.Format(@"{0}\Constellation{1:yyyyMMdd_hhmmss}", path, DateTime.Now); fileOut.OutputFileName = string.Format("{0}.wmv", output); // Adds the format to the job. You can add additional formats // as well such as Publishing streams or broadcasting from a port _job.PublishFormats.Add(fileOut); // Starts encoding _job.StartEncoding(); Thread.Sleep(3000); _job.StopEncoding(); _job.RemoveDeviceSource(_deviceSource); return(output); }