DBS
DBS

Reputation: 151

C# embed vlc control

I've tried to embed VLC into my WPF project. I've registered the axvlc.dll. Also downloaded VLC nightly build version 2.2.2

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: 'The invocation of the constructor on type 'Proj1.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '9'.

The thing is that I already successfully embedded the VLC in another project. I've also updated the PresentationFramework.dll to newer version.. Why do I get this exception? At my project I've just a window with windowsFormHost control and that's it. Here's my code:

AxVLCPlugin2 vlc = new AxVLCPlugin2(); 
winFormHost.Child = vlc;
vlc.CreateControl();

Upvotes: 0

Views: 2676

Answers (2)

Jody Sowald
Jody Sowald

Reputation: 391

It appears that your issue is not about the VLC plugin. Your error message indicates badly formed XAML in your window.

I would make sure that the XAML in your window is correct before you start looking for VLC related issues.

Here is a stack post about how to deal with that error message

But assuming that that stack post about bad XAML does not help you...

Having used the AxVLC ActiveX control for a few years in a Windows Forms project I can tell you how finnicky the whole of the VLC codebase is.

You should not need to add the AxVLCPlugin2 to your window yourself. You also should not need a WindowsFormHost control to host the AxVLC ActiveX COM component that should be available to you assuming that you have installed VLC on your computer in any form.

If you go to your window and then toolbox, you should be able to open up a list of com components via Choose Tools and this will include a VLC com component that lets you mess with it in the visual editor. This is a less error prone approach to adding the control to your application.

Follow this guide and you should be able to find the COM component

Using COM Components

That should solve your issue.

Upvotes: 0

SarC
SarC

Reputation: 118

Kindly try Vlc.DotNet. You can get the source and samples from github.

Even I was stuck with the same issue when trying to embed VLC plugin into my WPF project. Got success after using Vlc.DotNet.

Upvotes: 1

Related Questions