Skip to content

HTTP API client for vlc 2.0.1 Twoflower (Yes, vlc has an http api)

Notifications You must be signed in to change notification settings

mh-cbon/node-vlc-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vlc-api

HTTP API client for node.js an the browser. Tested with webpack, should work fine with browserify too.

(Yes, vlc has an http api)

Requirements

Host running VLC with the Web Interface enabled. VLC 2.1+ requires that a password is set.

Install

npm install @mh-cbon/vlc-api --save

Example

var vlc = require('vlc-api')({password: '123'});
// password: required by VLC 2.1+
// host: optional; defaults to 'localhost'
// port: optional; defaults to 8080
// username: optional; VLC currently requires this to be empty

// toggle pause
vlc.status.pause(function(err, status){
  // will be 'playing' or 'paused'
  console.log(status.state);
});

// fetches playlist object; different from status api
vlc.playlist(function(err, res){
  console.log(res);
});

API

$ node
> var vlc = require('./')({password: '123'});
undefined
> vlc
{ apiVersion:
   { vlc: '2.1.0 Rincewind',
     spec: 'https://github.com/videolan/vlc/tree/master/share/lua/http/requests/README.txt' },
  _base: 'http://localhost:8080',
  _authHeader: 'Basic OjEyMw==',
  status:
   { [Function]
     enqueue: [Function],
     addSubtitle: [Function],
     play: [Function],
     goto: [Function],
     pause: [Function],
     stop: [Function],
     resume: [Function],
     next: [Function],
     previous: [Function],
     prev: [Function],
     delete: [Function],
     empty: [Function],
     audioDelay: [Function],
     subtitleDelay: [Function],
     aspectRatio: [Function],
     sort: [Function],
     random: [Function],
     loop: [Function],
     repeat: [Function],
     discovery: [Function],
     fullscreen: [Function],
     volume: [Function],
     seek: [Function],
     preamp: [Function],
     equalizer:
      { [Function]
        enable: [Function],
        disable: [Function],
        preset: [Function] },
     title: [Function],
     chapter: [Function],
     audioTrack: [Function],
     videoTrack: [Function],
     subtitleTrack: [Function] },
  playlist: [Function],
  browse: [Function] }
> vlc.status.pause()
undefined
> vlc.status.resume()
undefined
>

Tests

  1. Run VLC with the http interface enabled on port 8080 with password '123'
  2. Get a playlist going
  3. Run npm test for a CRAZY ROBOT REMIX

License

MIT/X11.

Read more

Changes

Since original release by jhbrook

  • VLC 2.1 was added by Brandon Jones
  • webpack support (replaced request by hyperquest) was added by mh-cbon

About

HTTP API client for vlc 2.0.1 Twoflower (Yes, vlc has an http api)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%