public virtual double CaptureTime { get; }
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 file
string 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 here
if (_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:\LEADTOOLS22\Media";
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.