GithubHelp home page GithubHelp logo

mrpohoda / omxcontrol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rikkertkoppes/omxcontrol

0.0 2.0 1.0 88 KB

nodejs wrapper for omxplayer on the raspberry pi, integrates well with express

omxcontrol's Introduction

omxcontrol

Nodejs module to control omxplayer. Specifically written for the raspberry pi

Requirements

  • omxplayer (installed by default on the raspberry pi raspian image)
  • nodejs (apt-get install nodejs)
  • express (optional)

Install

npm install omxcontrol

Usage

Basic usage

omx = require('omxcontrol');

omx.start(filename);

omx.pause();

omx.quit();

Use with express as middleware. This type of usage exposes the above methods as an http api:

omx = require('omxcontrol');
express.use(omx());

http://localhost/omx/start/:filename
http://localhost/omx/pause
http://localhost/omx/quit

You actually might not want to pass the real file name to the http api, probably to simplify things, but in my case, omxplayer needs a specific url to play youtube video. For this usecase, omx() can be passed a mapping function to map the filename to something else. Calling the provided start method is required to actually start the video. Your logic can be async and even choose not to start things:

omx = require('omxcontrol');
express.use(omx(function(fn,start) {
    //do something special
    start(fn);
}));

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.