Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to stream video from vlc in c#

 class Program
{
    static void Main(string[] args)
    {
        FileInfo file = new FileInfo(@"C:UsersJmanVideoMaker.avi");

        var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
        // Default installation path of VideoLAN.LibVLC.Windows
        var libDirectory =
            new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));

        using (var mediaPlayer = new Vlc.DotNet.Core.VlcMediaPlayer(libDirectory))
        {

            var mediaOptions = new[]
            {
                ":sout=#rtp{sdp=rtsp://192.168.1.162:8008/test}",
                ":sout-keep"
            };

            //mediaPlayer.SetMedia(new Uri("http://hls1.addictradio.net/addictrock_aac_hls/playlist.m3u8"),
            //    mediaOptions);

            mediaPlayer.SetMedia(file, mediaOptions);

            mediaPlayer.Play();

            Console.WriteLine("Streaming on rtsp://192.168.1.162:8008/test");
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #stream #video #vlc
ADD COMMENT
Topic
Name
3+9 =