i have setup an rPi 3 with raspian lite and adafruit_video_looper to run at boot (looping usb content) and i need to make a GPIO button (momentary) to pause/resume omxplayer video. can anyone help ?? i've been working on this for a loong time now, can't even get the keyboard shortcuts to work. will be used at a museum with no keyboard/mouse or gui. anyone doing this, or have any advice/solution ?
From a quick look at the omxplayer source code it seems the majority of its control interface operates via DBus. There's even a dbuscontrol.sh script in the repo to handle remote control via bash. So:
You can read the GPIO ports from bash via sysfs (explore
/sys/class/gpio/...). Combined with the dbuscontrol script above that's probably the simplest method, but it'll involve repeated polling (you can't "wait on event" in bash).
For something a bit more efficient you could use one of the Python GPIO interfaces (RPi.GPIO, pigpiod, or gpio-zero) in combination with the Python DBus package (
python3-dbus depending on the version you want to use. This stackoverflow question may be useful if you want to go this route.
Hack on the omxplayer source (linked above) itself. This is probably the most efficient, but also the most complicated route (simply because omxplayer already has one control mechanism, dbus, and you'd need to augment or replace it to get it listening to the GPIO pins).