Question

I have started the VLC player in my application using this code:

Process.Start("C://Program Files//Videolan//VLC//VLC.exe", "\"rtsp://xxx.xxx.xx.xx:554/h264\" --qt-start-minimized --sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C:\\123.ogg,no-overwrite}");

Now I need to stop/close this. Please advice.

Was it helpful?

Solution

Process.Kill(); should do the trick.

A somewhat gentler way would be Process.CloseMainWindow, but depends on implementation.

Reference: Process.Kill Method (MSDN).

OTHER TIPS

You can kill by using the following code

try
{   
    foreach (Process proc in Process.GetProcessesByName("processname"))
    {
        proc.Kill();
    }
}
catch(Exception ex)
{

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top