4

I'm working on small home project for video broadcasting. I've found some example Example, but it does not works, because needed old version of library 0.8.6. So I found it, but I have exceptions on unmanaged code when I've tried to get components from API. So maybe somebody works with VLC for videobrodcasting I would like if you are Advise any examples.

enter image description here

1 Answer 1

11

I found a solution and used Vlc.DotNet wrapper I've installed nuget packages and wrote console app:

 class Program
{
    static void Main(string[] args)
    {
        FileInfo file = new FileInfo(@"C:\Users\Jman\VideoMaker.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();
        }
    }
}

Then I ran VLC media player and entered my link. And I got my videostream

rtsp://192.168.1.162:8008/test

You can look my test applications in my GitHub repository : VideoBroadcast

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.