Reputation: 1305
I started a omx instance based on this script. it works great, but I can't quit the player with q or alt f4 or ctrl-z.in desktop the keyboard commands always arrive on the desktop. especially if I start the script on the raspberry in CLI mode, I would never get out of the video.
What can I do here?
#!/bin/bash
### BEGIN INIT INFO
# Provides: omxplayer
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Displays video file in a loop using omxplayer
# Description:
### END INIT INFO
# Video (replace with the path and file name of your video)
video_path=/home/pi/video.mp4
#---- There should be no need to edit anything below this line ----
# Start displaying the video loop
case "$1" in start)
screen -dmS videoloop sh -c "omxplayer -o both $video_path -b --loop --no-osd"
echo "Video Playback Started"
;;
# Stop displaying video loop
stop)
sudo killall omxplayer.bin
echo "Video Playback Stopped"
;;
# Restart video loop if it died
repair)
if !(ps -a | grep omx -q)
then
screen -dmS videoloop sh -c "omxplayer -o local $video_path -b --loop --no-osd"
echo "The Video is now running"
fi
;;
*)
echo "Usage: /etc/init.d/videoloop {start|stop|repair}"
exit 1
;;
esac
Upvotes: 0
Views: 224