I'm using the following wrapper to use VLC in C#:
http://www.nht-center.net/VLC.net_Main.cs
And the following code to add the File to the VLC:
Code: Select all
options = new string[] { ":sout=#standard{access=udp,mux=ts,dst=" + RemoteIP + ":" + Port + "}",
":no-one-instance", ":no-loop", ":no-drop-late-frames" };
VLC.Error err = vlc.AddTarget(VideoFile, options);
if (err == VLC.Error.Success)
{
err = vlc.Play();
if (err == VLC.Error.Success)
{
err = vlc.Next();
if (err != VLC.Error.Success)
{
if (vlc.IsPlaying)
{
Message.Enqueue("Starting Video Stream: " + VideoFile + " on Port " + Port);
OnStatusMessage(EventArgs.Empty);
}
else
{
Message.Enqueue("Error starting to stream " + VideoFile + " on Port " + Port + ": VLC is not playing - " + vlc.GetError());
OnStatusMessage(EventArgs.Empty);
}
}
else
{
Message.Enqueue("Error selecting the target " + VideoFile + " on Port " + Port + ": " + vlc.GetError());
OnStatusMessage(EventArgs.Empty);
}
}
else
{
Message.Enqueue("Error playing the stream " + VideoFile + " on Port " + Port + ": " + vlc.GetError());
OnStatusMessage(EventArgs.Empty);
}
}
else
{
Message.Enqueue("Error adding target " + VideoFile + " on Port " + Port + ": " + vlc.GetError());
OnStatusMessage(EventArgs.Empty);
}
Where VideoFile is the Filename including the Path to the File.
I got sometime the return of 4 (unkonwn error) at the VLC_AddTarget() method, but sometimes it works.