Page 1 of 1

Using vlc.httpd

Posted: 05 Oct 2016 11:36
by Kirrrr
Hey there!

First of all, I'm pretty familiar with programming but pretty new with VLC Lua scripting.

I want to create ancillary custom http-server for VLC to expose some dynamic information (e.g. current subtitle) so external applications can randomly read it. It can be realized as an interface or as an extension depending on existing options.

The matter is that I can't find any wokring example of using vlc.httpd and its handler to bring up a simple server. VLC Lua Readme https://www.videolan.org/developers/vlc ... README.txt gives very small hint on this topic. Wide Internet searching gave me almost nothing too. I've tried to utilize some experience from Syncplay script but is uses vlc.net.listen_tcp not the vlc.httpd and my approach was unsuccessful.

So, I have 2 questions:
1. What is the right form of script to create ancillary http-server: interface or extension?
2. Is there any basic code to start with?

Best regards!

Re: Using vlc.httpd

Posted: 05 Oct 2016 14:52
by mederi

Re: Using vlc.httpd

Posted: 05 Oct 2016 17:25
by Kirrrr
Thank you mederi!

Well, that's what I've done.

Environment: Win7 x64 Pro, VLC 2.2.4, firewall is opened for all incoming connections to vlc.exe.

1. Renamed http.lua into http2.lua.
2. Changed line 35 into vlc.msg.info("Lua HTTP interface 2") just to make it clear.
3. Changed line 336 from h = vlc.httpd() to h = vlc.httpd("localhost", 41337)
4. Put http2.lua into "C:\Users\USER\AppData\Roaming\vlc\lua\intf\" (alongside with properly working syncplay.lua).
5. Started VLC with command line: vlc.exe --extraintf=luaintf --lua-intf=http2 --no-quiet --no-input-fast-seek --play-and-pause --start-time=0 --no-one-instance --no-one-instance-when-started-from-file (such command line is used by Syncplay).
6. Tried to open http://localhost:8080/ — everything is ok, standard VLC web-interface is working as supposed to.
7. Tried to open http://localhost:41337/ — nothing is happened, ERR_CONNECTION_REFUSED.

What have I done incorrectly?

Re: Using vlc.httpd

Posted: 07 Oct 2016 11:33
by Kirrrr
Tried several variations. No luck.

Is there any really WORKING sample of user's Lua extension/script for VLC which utilizes vlc.httpd? :-|

Re: Using vlc.httpd

Posted: 26 Nov 2016 16:27
by Etoh
For modern versions of Syncplay the interface script should be in $VLC_Directory\lua\intf\ rather than %APPDATA%\vlc\lua\intf - what folder is http.luac in? You probably want your interface script in the same folder as http.luac.

Also, due to how VLC filename finding works, it might be helpful to call it something other than http* (I can't remember if that can be an issue or not, it has been a number of years).