VLC Http Service
droopy-vlc is an HTTP service that sends commands to VLC's HTTP endpoint.
Example Usage
After installing the npm module (droopy-vlc), you can require the service and start controlling Vlc.
>>npm install droopy-vlc
var VlcService = vlc = "http://:password@localhost:8080"; vlc;
VLC Status
All methods return Q promises that resolve with a VlcStatus object
fullscreen: 'false' aspectRatio: 'default' time: '1264' timeDisplay: '21:04' volume: '0' duration: '6572' durationDisplay: '1:49:32' state: 'playing' rate: '1' position: '0.19233977794647' filename: 'myvideofile.avi'
Supported Methods
status()
Passes back a VlcStatus
object.
vlcServicestatus;
seek(time)
Requires a time parameter in seconds.
//move the the 2 minute markvlcService;
volume(val)
Requires a volume level between 0 and 200.
//max volumevlcService;
togglePause()
If currently paused the video will play, otherwise pause.
vlcService;
fullscreen()
If currently fullscreen, it will shrink the window, else make it fullscreen
vlcService;
rate(speed)
Adjusts the playback speed. Unfortunately I couldn't find a way to make it go backwords like a "rewind"
//Play 3 times as fast (fast forward)vlcService;
next()
Next song in the playlist.
vlcServicenext;
previous()
Previous song in the playlist.
vlcServiceprevious;
play(id)
Play song by id in the playlist.
vlcService;
deleteItem(id)
Remove song by id in the playlist.
vlcService;
empty()
Remove all song in the playlist.
vlcService;
playlist()
Return the actual playlist [{ name : String, duration : Number, id : Number},... ]
vlcService;
loop()
Repeat the entire playlist
vlcService;
repeat()
Repeat the last song
vlcService;
Enabling VLC Http Endpoint
VLC's Http endpoint is not enabled by default. You can enable by launching VLC with a --etraintf http
flag. VideoLan documentation
UPDATE: New versions now require you to setup a password to access the HTTP endpoint. To do this go to Tools -> Preferences -> Main Interfaces -> Lua -> Lua HTTP Password.
>>C:\Program Files (x86)\VideoLAN\VLC\vlc.exe -f <filepath> --etraintf http
Opening and closing VLC with node.js
The following are helper methods that I use to launch and close VLC on Windows PC.
exec = exec; var { try //var cmd = 'tasklist /fi "ImageName eq vlc.exe" /fo csv /nh'; var cmd = 'taskkill /IM vlc.exe'; var child = ; catch ex console; }; var { var params = " -f " + " \"" + filepath + "\" --extraintf http"; var child = ;};