Reputation: 965
I encountered an strange problem in c#...
I was trying to connect to an ONVIF camera through VLC library(tell me if there's a better way)
And I found a nice pre-implemented library called nVLC on the NuGet, then I used it, and it was very good,
But when I changed the target framework in c# I realized that nVLC's target framework is different from the one I selected,
And when I changed the target framework back to 4.0(As nVLC's) I've got a strange LibVlcInitException exception,
Then I downloaded the nVLC source code and debug database as well to find out what is wrong in the nVLC
Finally I found that the exception is not in the nVLC's code but somewhere in C# internal
library loading mechanism that handles extern methods.
I even tried to load the libvlc.dll using kernel method LoadLibrary() in my project but this
one failed like before...
m_hMediaLib = LibVlcMethods.libvlc_new(args.Length, args); //nVLC internal line that error occures.
//and:
IMediaPlayerFactory _factory = new MediaPlayerFactory(); //in my code.
I prefer to use VLC to connect to my ONVIF camera(my camera give me a H264 format).
finally:
Thank you...
Upvotes: 0
Views: 1276
Reputation: 965
I found the answer after a hard working week!!
This is because of nVLC's way to find the VLC installation path...
If you have installed a x64 VLC this will add a key named "SOFTWARE\VideoLAN\VLC" into the registery for sure.
Then in the nVLC it check for process(Environment.Is64BitProcess) if it is x64 get the VLC installation path from "SOFTWARE\VideoLAN\VLC" (the one I missing because I installed x86 version of VLC) but if process is x86 it search in "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" for VLC.
Hope help you...
Upvotes: 1