Code Monkey home page Code Monkey logo

vlc-simple-player's Introduction

VLC simple player

Simple module that starts VLC player via command-line together with HTTP interface enabled. It provides a unified API to start playing a file and to get information about current track.

Install

npm install vlc-simple-player --save

(Please note you'll need VLC binary installed in your system, you can download it on official website)

Example usage

var VLC = require('vlc-simple-player')

// start a fullscreen player
var player = new VLC('./path-to-your-movie/test.mp4')

// log current track time every second
player.on('statuschange', (error, status) => {
  console.log('current time', status.time)
})

Interface

  • new VLC(path[, options]) – starts a VLC player in fullscreen
    • path – string path to the video file ./test.mov
    • options – object with additional options
      • {password: String} will set a custom password for the HTTP interface (instead of random, which can be accessed by player.getPassword() method, btw)
      • {port: Number} will set a custom port for the HTTP interface (instead of default 8080)
      • {arguments: Array} will replace default command-line arguments (--fullscreen, --loop, --no-video-title)
  • player.on(eventName, callback) - registers an event
    • eventName – a string, available options are:
      • 'error' – stderr callback with error as an argument
      • 'statuschange' – callback that fires every second if the movie is playing
    • callback – a function with error and status object as an arguments
  • player.request(path, callback) - exposed request method to the VLC HTTP interface
    • path – a string, HTTP GET path with response in JSON format. For example: vlc.request('/requests/status.json?command=pl_pause') – toggles a pause. list of HTTP requests and interface description
    • callback – a function with error and status object as an arguments
  • player.process - exposed spawned process
  • player.quit() – stops the movie and close the player (via SIGKILL)

Contribution

Please feel free to submit a pull request for a bug fix or new features

vlc-simple-player's People

Contributors

mxkacsa avatar valiafetisov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.