TVideoGrabber WPF component
The sample code can be found in the "WPFDemo" project included in the package under CSharp_VB.NET\DEMOS\C#\WPFDemo(legacy).
Assuming the WPF control in which the video will be shown is named "image1", instantiate a VideoGrabberWPF instance and connect the OnFrameRefresh event as follows:
using...
using VidGrabNoForm;
namespace WpfApplication1
{
public partial class MainWindow: Window
{
VideoGrabberWPF Vg;
public MainWindow()
{
InitializeComponent();
image1.Stretch = Stretch.UniformToFill;
Vg = new VideoGrabberWPF();
Vg.OnFrameRefresh += new VideoGrabberWPF.On_WPF_FrameRefreshHandler(Vg_OnFrameRefresh);
}
void Vg_OnFrameRefresh(object sender, VideoGrabberWPF.TOn_WPF_FrameRefreshArgs e)
{
image1.Source = e.BitmapSource;
}
VB APPLICATION
Assuming the WPF control in which the video will be shown is named "image1", instantiate a VideoGrabberWPF instance and connect the OnFrameRefresh event as follows:
Imports VidGrabNoForm
Class Window1
Public Vg As VideoGrabberWPF
Public Sub New()
InitializeComponent()
image1.Stretch = Stretch.UniformToFill
Vg = New VideoGrabberWPF()
AddHandler Me.Vg.OnFrameRefresh, New VideoGrabberWPF.On_WPF_FrameRefreshHandler(AddressOf Vg_OnFrameRefresh)
End Sub
Private Sub Vg_OnFrameRefresh(ByVal sender As Object, ByVal e As VideoGrabberWPF.TOn_WPF_FrameRefreshArgs)
image1.Source = e.BitmapSource
End Sub
It is possible to then start the preview, recording, playback or reencoding, and use the events the same way as shown in the MainDemo project, except that the video will appear in the WPF control.
E.g.:
Vg.PlayerFileName = "myclip.wmv"
Vg.OpenPlayer()