public virtual Image GetStillImage(
int timeOut
)
public:
virtual Image^ GetStillImage(
int timeOut
)
timeOut
Value containing the maximum time to wait for the image, in milliseconds.
The System.Drawing.Image object
If TimeOut is -1, the method's time-out interval never elapses. If the method fails, an error is raised. For more information, refer to the Error Codes.
using Leadtools;
using Leadtools.MediaFoundation;
using LeadtoolsMediaFoundationExamples.Fixtures;
public PlayCtrlForm _form = new PlayCtrlForm();
public PlayCtrl _playctrl = null;
public bool _result = false;
public string _inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi");
public string _outFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_GetStillImageExample.jpg");
public void GetStillImageExample()
{
// reference the play control
_playctrl = _form.PlayCtrl;
try
{
// set the test timer on our form
_form.TestTimer.Interval = 2000; // wait 2 seconds after start
_form.TestTimer.Tick += GetStillImage_Helper;
// set input media file
_playctrl.SourceFile = _inFile;
// set the timer on
_form.TestTimer.Start();
}
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 (_playctrl.State == PlayState.Running)
Application.DoEvents();
// check for the captured image file and set the result
if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _outFile)))
_result = true;
}
public void GetStillImage_Helper(object sender, EventArgs e)
{
// get a still image
Image image = _playctrl.GetStillImage(-1);
if (image != null)
image.Save(_outFile, ImageFormat.Jpeg);
_form.TestTimer.Stop();
// stop the playback
_playctrl.Stop();
}
static class LEAD_VARS
{
public const string MediaDir = @"C:\LEADTOOLS23\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