Node.js + Express + socket.io interface for omxplayer on a Raspberry Pi.
This project replaces completely omxplayerphp.
This project requires Node.js 0.10.40 or greater on your Raspberry Pi. The current versions of Raspbian install only version 0.6, so you need to follow the instructions in this page to get version 0.10 up and running.
For your convenience, install also supervisor.
To install this code in your Raspberry Pi:
- Clone the project.
- Run
npm install
on the command line. - Copy your movie files (including subtitle files) in the
/home/pi/movies
folder. - Run the command
supervisor server.js
on the command line. - Browse to
http://[YOUR_RASPI_IP_HERE]:3000
to use the application.
To be able to interact with the server, consider installing omxplayerios on your iOS devices.
The application has a very simple protocol:
- Whenever a new client connects, it gets the list of movies, the available
disk space and the name of the current movie automatically. The respective
messages are
movies
,disk
andcurrent_movie.
- All messages have the same format:
{ method: 'method_name', response: [array]|string }
- Response messages include the name of the api method in the
method
field. - The
movies
message returns a list of filenames. - The
disk
message returns a string with the number and unit, like "14G" meaning 14 gigabytes. - The
current_movie
message returns a string with the filename of the movie currently playing. - The
play
message triggers a broadcast to all connected clients of thecurrent_movie
message. - The
stop
message triggers a broadcast to all connected clients of thestop
message. - The
command
message does not trigger a broadcast nor returns anything.
Check the LICENSE file for details.