A kid-friendly touch-controlled library media player on the Raspberry Pi
- Raspberry Pi 3 Model A+ running Raspbian Stretch
- Pimoroni HyperPixel 4.0 Touch Screen
- Adafruit Mini External USB Stereo Speaker
-
Node.js v12.x (LTS):
https://github.com/nodesource/distributions/blob/master/README.md#debinstall -
Yarn 1.19.x:
https://yarnpkg.com/lang/en/docs/install/#debian-stable
Important on Raspberry Pi: Executeyarn config set child-concurrency 1
before executingyarn install
.
Otherwise the SDCard will get hammered by 5 parallel build processes and the system will overload! -
Raspbian Stretch Packages (additional to Raspbian Lite)
omxplayer
for media playbackchromium-browser
for the Web UI- An X desktop environment (I used LXDE) with autologin enabled.
-
Fork/Clone
-
Install dependencies with
yarn install
-
Create the SQLite database and tables with
npm run initdb
(ornpm run initdb:prod
) -
Fill the library SQLite database with
npm run scan
(ornpm run scan:prod
)
This will executeknex seed:run --env development
to seed the database with the contents of themedia
folder. -
Fire up the server with
npm start
-
Start the front-end with
DISPLAY=:0 chromium-browser --kiosk http://localhost:3000
Most of the REST API & DB backend code is based on the examples in https://github.com/mjhea0/node-koa-api.
It was of great help to have such a nice template to implement my own requirements.
Volume control with amixer
amixer cset numid=3,iface=MIXER,name='PCM Playback Volume' 10%
Playback control with omxplayer
omxplayer -o alsa media/one_love.mp3
Other omxplayer options
-l --pos n Start position (hh:mm:ss)
--no-osd Do not display status information on screen
--no-keys Disable keyboard input (prevents hangs for certain TTYs)