0

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 ?

1

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:

Option 1

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).

Option 2

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 (python-dbus or python3-dbus depending on the version you want to use. This stackoverflow question may be useful if you want to go this route.

Option 3

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).

  • I really appreciate this info Dave. Now I have a direction to point my efforts instead tinkering with basically everything. – taylor2k5 Sep 13 '16 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.