Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Can't Set VLCLibDirectory #190

Closed
CaptRR opened this issue Sep 10, 2016 · 1 comment
Closed

Can't Set VLCLibDirectory #190

CaptRR opened this issue Sep 10, 2016 · 1 comment

Comments

@CaptRR
Copy link

CaptRR commented Sep 10, 2016

I'm running into an odd problem in VB. I can set the VLCLibDirectory in the control properties in the IDE. This is great on my development machine and x64 machines, since the VLC directory path is the same. The problem is on other machines where the path is different. I tried leaving the VLCLibDirectory blank in the IDE and adding the code below

Private Sub Vlc2_VlcLibDirectoryNeeded(sender As Object, e As VlcLibDirectoryNeededEventArgs) Handles Vlc2.VlcLibDirectoryNeeded
    Vlc2.VlcLibDirectory = New IO.DirectoryInfo("C:\Program Files (x86)\VideoLAN\VLC")


End Sub

However enven though the sub does run, and writes the Directory into the Vlc2 control, I get the error

An exception of type 'System.Exception' occurred in Vlc.DotNet.Forms.dll but was not handled in user code
Additional information: 'VlcLibDirectory' must be set.

I am kind of scratching my head, it seems I either put the path in the control properties (and then other computers can never have the VLC install directory anywhere else) or it won't run.

Thanks

@jeremyVignelles
Copy link
Collaborator

As of 2017, we provide a sample code for loading libraries for the right process architecture:

if (IntPtr.Size == 4)
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x86\"));
else
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x64\"));

This assumes you are redistributing libvlc with your application (even if it's a little heavy, I'd recommand that way, especially #288). That way, you could redistribute the version of libvlc that you tested on your machine and avoid several issues. Users also won't need to have VLC installed to use your app.

You could also try to detect the OS architecture and go your way.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants