Ok so there is virtually no info about how to successfully pair
omxplayer, so I took it as a challenge and came up with a workaround, that actually works. :D
What needs to be done:
xscreensaver to blank and set the "Blank After" to time you want the screensaver to kick in...
Create a small script and stuff it somewhere,
/etc/ is as good a place as any
chmod +x /etc/video_screensaver.sh
Edit the file and add the following
while read input; do
case "$input" in
UNBLANK*) killall omxplayer.bin ;; # This will kill the omxplayer process
BLANK*) omxplayer --loop --no-osd --no-keys /home/pi/Desktop/Video/Guardians.mp4 & ;; # Don't forget the & on the end or it will never stops, just add your movie file path
/usr/bin/xscreensaver-command -watch | process
This little script/daemon utilises
xscreensaver-command -watch and looks for a change of state. We will need to have it start on boot. I'm using Raspbian from NOOBS so I edited this file:
by adding this line to the end:
My whole autostart file for my kiosk looks like this:
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xset s off
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium Default/Preferences
@chromium-browser --noerrdialogs --kiosk --kiosk-printing https://google.sk --incognito --disable-translate
Works unbelievably great on my Pi 3, the script is not taxing the CPU at all. It works fine with my touch screen.
I have been testing it now for 4 hours and my Pi is happily staying at <60°C with no cooling, whilst playing loop trailers... The CPU usage is staying very low (about 3% per core while playing), compared to
mplayer, it's a day and night difference.
One more thing that can be useful and easily added is to have it play a video file at random from a folder on each screensaver start...
One more edit note, if you're using kiosk mode with
chromium you might want to disable this two lines in
#@lxpanel --profile LXDE-pi
#@pcmanfm --desktop --profile LXDE-pi
I found out that clicking for long enough on the top of where the taskbar is, will show it and let you escape chromium... (make sure you have ssh access to enable it again if you need it!)