I'd like to use my raspberry pi3 to automatically show some videos or pictures in a folder after boot. At the current state, even only pictures are ok, even if I'd like to have both.
For pictures I found fbi
, and it works if I launch it manually.
I am not able to make it run at startup.
This is the script I added in /etc/init.d/
:
#! /bin/sh
### BEGIN INIT INFO
# Provides: asplashscreen
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Show custom splashscreen
# Description: Show custom splashscreen
### END INIT INFO
do_start () {
/usr/bin/fbi -d /dev/fb0 -T 1 -noverbose -a -t 5 /home/pi/Photos/*.jpg &
exit 0
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
exit 0
;;
*)
echo "Usage: asplashscreen [start|stop]" >&2
exit 3
;;
esac
which I simply copied and modified the actual command.
I then add it to the run level with sudo update-rc.d myscript defaults
.
Now, the problem is that the images start play just before the login prompt is shown and after some seconds they get interrupted (in correspondence of the end of the boot process).
If the picture part works, I can try to move forward and add also videos (but in this second case I have other problems)
Thanks for the help.
EDIT:
If I try to show only videos with omxplayer
with the following script
#!/bin/sh
# get rid of the cursor so we don't see it when videos are running
setterm -cursor off
# set here the path to the directory containing your videos
VIDEOPATH="/home/pi/Videos"
# you can normally leave this alone
VIDEOSERVICE="omxplayer"
# now for our infinite loop!
while true; do
if ps ax | grep -v grep | grep $VIDEOSERVICE > /dev/null
then
sleep 1;
else
for entry in `find ${VIDEOPATH} -type f`; do
clear
# forcing output to local to avoid sounds: -o local
omxplayer -r -b "$entry" > /dev/null
done
fi
done
(called in /etc/rc.local
) it works, so it is probably something related to fbi