Skip to content

Latest commit

 

History

History
64 lines (53 loc) · 3.59 KB

README.md

File metadata and controls

64 lines (53 loc) · 3.59 KB

node-omxplayer-sync

synchronized looping video for raspberry pi & omxplayer!

node-omxplayer-sync utilizes a socket.io connection between and broadcaster and many listener raspberry pis provided to synchronized playback. The broadcaster sends out a notification to all listeners when its video has looped. This resets all listeners (including itself) to the start of the loop playback. All listeners synchronize on one full playback loop of the main broadcaster and will continually attempt to re-sync each time the main broadcaster's file loops.

Important Details

  • configure the ip address of one of the raspberry pis to act as the main broadcaster with a Static IP of 192.168.0.99, or dive into the omx-sync.js file and adjust the socket.io IP assignment manually to whatever you like.
  • connect all pis to the same local network via wifi or ethernet
    • make sure that your router's LAN ip address is 192.168.0.1

Installer Script

  1. ssh into your pi
  2. run wget -qO- https://raw.githubusercontent.com/bmoren/node-omxplayer-sync/master/install.sh | bash
  3. dont forget to sudo raspi-config and change the boot options to command line (auto login as user pi)
  4. to change the video file which plays on boot, alter the video file path in your ~/.bashrc or change the filepath in the installer script before running it!

How to get files onto each pi system

Prefered Method

  1. rsync the files onto the pi over ssh
  2. rsync -aP path/to/local/source/video.mp4 [email protected]:/home/pi/node-omxplayer-sync
  3. node omx-sync.js path/to/pi/video.mp4
  4. If using auto running on startup, dont forget to update the ~/.bashrc to the new files.

Secondary Method

  1. if you didnt use the installer script, install usbmount to mount flashdrives: sudo apt-get install usbmount
  2. copy the file from a flashdrive: cp /media/usb/yourfile.mp4 ~/node-omxplayer-sync/
  3. node omx-sync.js path/to/video.mp4

There may be issues with playback / sync when running videos from external USB media, especially for long files. For best results, run the files from the filesystem SD card. This is most easily accomplished using rsync

auto-run on startup (the installer script does this automatically!)

  1. run sudo raspi-config, navigate to the boot options and choose command line (auto login as user pi)
  2. install forever: npm install forever -g
  3. nano ~/.bashrc
  4. find the line to load NVM export NVM_DIR="/home/pi/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm or something similar
  5. add forever start ~/node-omxplayer-sync/omx-sync.js ~/absolute/path/to/video.mp4 below the NVM listeners
  6. ctrl+x then Y then Enter to save
  7. sudo reboot

Manual Install:

  1. Setup your Pi
  2. sudo apt-get update
  3. sudo apt-get upgrade
  4. git clone this repository to ~/ on your raspberry pi
  5. if you are running raspbian jessie lite, install omxplayer & rsync
  6. sudo apt-get install omxplayer
  7. install nvm & node.js latest
  8. wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
  9. source ~/.bashrc
  10. nvm install stable
  11. update & install npm packages
  12. cd ~/node-omxplayer-sync
  13. npm install
  14. node omx-sync.js path/to/video.mp4 on each pi to run the sync video!

Tested on