Page 1 of 1

Programmatically controlling VLC (via C# and/or Telnet)

Posted: 09 Sep 2006 09:46
by jakewharton
I have an application which manages an audio/video library and a playlist. Currently I run VLC via a Process with arguments to play a playlist of the file and "vlc:quit" to close the application when the file has ended. The problem is the Exiting event does not fire when vlc closes itself so I do not know when to start the next file. I began to dabble in the telnet interface but lacking a decent guide I couldn't get it to work. If anyone has any suggestions regarding either of these two methods or perhaps a better method, it would be greatly appreciated.

Posted: 12 Sep 2006 01:41
by Rozis
I'm doing much the same thing, so maybe i can help if your're using Windows. Then i would expect you called Vlc via the Windows API-function Createproccess(), You could wait for Vlc to stop using waitforsingleobject(). Although i program all my code in Visual Objects here is the source:

method wait(floatseconds,lkill) class runapp
local dwresult,dwhowlong as dword
dwhowlong:=if(IsNil(floatseconds),infinite,floatseconds*1000)
dwresult:=waitforsingleobject(self:phandle,dwhowlong)
if dwresult=wait_timeout
if lkill
return self:kill() //Program takes too much time: kill it
endif
else
if self:houtput!=null_ptr // if output was redirected restore it
CloseHandle(self:houtput)
self:houtput:=null_ptr
endif
if self:hinput!=null_ptr // if input was redirected restore it
CloseHandle(self:hinput)
self:hinput:=null_ptr
endif
endif
return .t.

Just give me a yell if you need more help...

Rozis