Using vlc.httpd

Discuss your Lua playlist, album art and interface scripts.
Kirrrr
New Cone
New Cone
Posts: 9
Joined: 05 Oct 2016 11:07

Using vlc.httpd

Postby Kirrrr » 05 Oct 2016 11:36

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!

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: Using vlc.httpd

Postby mederi » 05 Oct 2016 14:52


Kirrrr
New Cone
New Cone
Posts: 9
Joined: 05 Oct 2016 11:07

Re: Using vlc.httpd

Postby Kirrrr » 05 Oct 2016 17:25

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?

Kirrrr
New Cone
New Cone
Posts: 9
Joined: 05 Oct 2016 11:07

Re: Using vlc.httpd

Postby Kirrrr » 07 Oct 2016 11:33

Tried several variations. No luck.

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

Etoh
Blank Cone
Blank Cone
Posts: 60
Joined: 12 Jan 2013 16:33

Re: Using vlc.httpd

Postby Etoh » 26 Nov 2016 16:27

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).


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 6 guests