Gets the amount of time the capture has been running, in seconds.
public virtual double CaptureTime { get; } Public Overridable ReadOnly Property CaptureTime As Double public:virtual property double CaptureTime {double get();}
A value representing the total capture time in seconds.
This value is reset to zero when you start a new capture.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public CaptureCtrl _capturectrl;public double _totalTime;public void ErrorAbortExample(){// reference the capture control_capturectrl = _form.CaptureCtrl;// output filestring outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_ErrorAbortTest.avi");try{// set a test timer to interrupt the capture_form.TestTimer.Interval = 5000;_form.TestTimer.Tick += new EventHandler(TestTimer_Tick);_form.TestTimer.Start();// initialize the total capture time_totalTime = 0;// subscribe to the ErrorAbort event_capturectrl.ErrorAbort += new ErrorAbortEventHandler(CaptureCtrl_ErrorAbort);// subscribe to the event_capturectrl.Progress += new ProgressEventHandler(CaptureCtrl_Progress);// set a video device, use the name of your device hereif (_capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");_capturectrl.VideoDevices["USB"].Selected = true;// select the MPEG4 video compressor_capturectrl.VideoCompressors.Mpeg4.Selected = true;// set an audio device, use the name of your device here_capturectrl.AudioDevices["USB"].Selected = true;// set the target output file_capturectrl.TargetFile = outFile;// only 10 seconds of capture time_capturectrl.TimeLimit = 10;_capturectrl.UseTimeLimit = true;// capture it now!_capturectrl.StartCapture(CaptureMode.AutoFramesAndAudio);}catch (Exception){_result = false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (_capturectrl.State == CaptureState.Running)Application.DoEvents();}public void TestTimer_Tick(object sender, EventArgs e){// stop the capture_capturectrl.StopCapture();}public void CaptureCtrl_Progress(object sender, ProgressEventArgs e){_totalTime = _capturectrl.CaptureTime;}public void CaptureCtrl_ErrorAbort(object sender, ErrorAbortEventArgs e){// set result_result = true;}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _capturectrl As CaptureCtrlPublic _totalTime As DoublePublic Sub ErrorAbortExample()' reference the capture control_capturectrl = _form.CaptureCtrl' output fileDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_ErrorAbortTest.avi")Try' set a test timer to interrupt the capture_form.TestTimer.Interval = 5000AddHandler _form.TestTimer.Tick, AddressOf TestTimer_Tick_form.TestTimer.Start()' initialize the total capture time_totalTime = 0' subscribe to the ErrorAbort eventAddHandler _capturectrl.ErrorAbort, AddressOf CaptureCtrl_ErrorAbort' subscribe to the eventAddHandler _capturectrl.Progress, AddressOf CaptureCtrl_Progress' set a video device, use the name of your device hereIf _capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End If_capturectrl.VideoDevices("USB").Selected = True' select the MPEG4 video compressor_capturectrl.VideoCompressors.Mpeg4.Selected = True' set an audio device, use the name of your device here_capturectrl.AudioDevices("USB").Selected = True' set the target output file_capturectrl.TargetFile = outFile' only 10 seconds of capture time_capturectrl.TimeLimit = 10_capturectrl.UseTimeLimit = True' capture it now!_capturectrl.StartCapture(CaptureMode.AutoFramesAndAudio)Catch e1 As Exception_result = FalseEnd Try' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While _capturectrl.State = CaptureState.RunningApplication.DoEvents()LoopEnd SubPublic Sub TestTimer_Tick(ByVal sender As Object, ByVal e As EventArgs)' stop the capture_capturectrl.StopCapture()End SubPublic Sub CaptureCtrl_Progress(ByVal sender As Object, ByVal e As ProgressEventArgs)_totalTime = _capturectrl.CaptureTimeEnd SubPublic Sub CaptureCtrl_ErrorAbort(ByVal sender As Object, ByVal e As ErrorAbortEventArgs)' set result_result = TrueEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 20\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
