cascha42 / node-omxplayer-sync

synchronized looping video for raspberry pi & omxplayer!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  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

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

  • Node v9.3.0
  • omxplayer Version: 5a25a57 [debian] Repository: XECDesign/omxplayer.git
  • RASPBIAN STRETCH LITE | 2017-11-29
  • dbus-native@0.2.3
  • socket.io@1.7.4

About

synchronized looping video for raspberry pi & omxplayer!

License:GNU General Public License v3.0


Languages

Language:JavaScript 56.1%Language:Shell 43.9%