npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

droopy-vlc

v0.1.0

Published

Node wrapper for VLC http endpoints

Downloads

14

Readme

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 = require("droopy-vlc"),
    vlc = new VlcService("http://:password@localhost:8080");

vlc.volume(80).then(function(vlcStatus) {
	console.log("Successfully set volume to " + vlcStatus.volume);
});

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.

vlcService.status().then(function(status) {
	console.log(status); //You could continuously poll this
});

####seek(time) Requires a time parameter in seconds.

//move the the 2 minute mark
vlcService.seek(120).then(function(status) {
	console.log(status);
});

####volume(val) Requires a volume level between 0 and 200.

//max volume
vlcService.volume(125).then(function(status) {
	console.log(status);
});

####togglePause() If currently paused the video will play, otherwise pause.

vlcService.togglePause().then(function(status) {
	//statue.state will be "paused" or "playing"
	console.log(status);
});

####fullscreen() If currently fullscreen, it will shrink the window, else make it fullscreen

vlcService.fullscreen().then(function(status) {
	//statue.fullscreen will be "true" or "false"
	console.log(status);
});

####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.rate(3).then(function(status) {
	console.log(status);
});

####next() Next song in the playlist.

vlcService.next().then(function(status) {
	console.log(status);
});

####previous() Previous song in the playlist.

vlcService.previous().then(function(status) {
	console.log(status);
});

####play(id) Play song by id in the playlist.

vlcService.play().then(function(status) {
	console.log(status);
});

####deleteItem(id) Remove song by id in the playlist.

vlcService.deleteItem().then(function(status) {
	console.log(status);
});

####empty() Remove all song in the playlist.

vlcService.empty().then(function(status) {
	console.log(status);
});

####playlist() Return the actual playlist [{ name : String, duration : Number, id : Number},... ]

vlcService.playlist().then(function(vlcPlaylist) {
	console.log(vlcPlaylist);
});

####loop() Repeat the entire playlist

vlcService.loop().then(function(status) {
	console.log(status);
});

####repeat() Repeat the last song

vlcService.repeat().then(function(status) {
	console.log(status);
});

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 = require('child_process').exec;

var killVlc = function() {
	try {
		//var cmd = 'tasklist /fi "ImageName eq vlc.exe" /fo csv /nh';
		var cmd = 'taskkill /IM vlc.exe';
		var child = exec(cmd, function(err, stdout, stderr) {
			if (err) {
				console.log(err);
				console.log(stderr);
			}
		});
	} catch (ex) {
		console.log("kill catch");
	}
};

var launchVlc = function(filepath) {
	var params = " -f " + " \"" + filepath + "\" --extraintf http";
	    
	var child = exec(options.exePath + params, function(err, stdout, stderr) {
		if (err) {
			console.log(err);
			console.log(stderr);
		}
	});
};