简体   繁体   中英

Launching a stream in VLC from C# program

Maybe it is just late, but I ran into a dead end, hoping someone can help me out.

I have a very simple program which is supposed to work like this: The user can see a list of available streams. The user picks a stream to watch. After picking a stream I then want to launch VLC media player for them and play it.

I have everything in order except from one last thing - I don't know how to make the player play the stream. I assumed it would just be something like this:

System.Diagnostics.Process.Start(pathVLC, streams[choice]);

where
PathVLC is the path to the users player, for example C:\\Programs\\VLC\\vlc.exe
streams is an array of strings, all on the form " http://somerandomstream.m3u8 "
choice is the stream the user wanted to see.

While VLC opens successfully, nothing else happens, and I am completely lost on how to actually tell VLC to play the stream. What am I missing?

Edit: Looking at Vaughan Hilts answer I figured it out!

System.Diagnostics.Process VLC = new System.Diagnostics.Process();
            VLC.StartInfo.FileName = pathVLC;
            VLC.StartInfo.Arguments = "-vvv " + streams[choice];
            VLC.Start();

You'll be required to start it up from the command line like so:

 vlc -vvv http://www.example.org/your_file.mpg

This means you will need to pass in the -vvv flags as well in your array to succesfully start the stream.

我将从检查支持的命令行参数开始,例如这里

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM