willprice / python-omxplayer-wrapper

:tv: Control OMXPlayer, the Raspberry Pi media player, from Python
http://python-omxplayer-wrapper.readthedocs.io
GNU Lesser General Public License v3.0
253 stars 71 forks source link

Any working examples using OMXPlayer-wrapper with GPIO buttons? #79

Closed darrell24015 closed 7 years ago

darrell24015 commented 7 years ago

Issue Report

Description

I am not getting any results trying to start/pause/restart a video with GPIO buttons. The video only plays with no further ability to control it.

Problem reproduction

Sample code thus far:

` from omxplayer import OMXPlayer from time import sleep import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM) GPIO.setwarnings(True)

myButton = 4

GPIO.setup(myButton, GPIO.IN, GPIO.PUD_UP)

def getButtonPress(): while 1: if GPIO.input(myButton) == GPIO.Low: return True break

video = '/home/pi/path_to_video.mp4'

player = OMXPlayer(video)

try: if getButtonPress() == True: player.play()

except KeyboardInterrupt: print('Closing Player') GPIO.cleanup() player.quit() `

Environment details

Software Version
python-omxplayer-wrapper 0.1.0
python-dbus (dpkg -s python-dbus) 1.2.0
python (python --version) 2.7.9
omxplayer (omxplayer --version) 6c90c75

Feature Request

Description

Would like to be able to pause and then reset the video with a second button press, or stop the video with the KeyboardInterrupt

willprice commented 7 years ago

Did you manage to produce a working example @darrell24015? If so I'm sure others would appreciate it if you could share it :)

JE-Random-Tech commented 4 years ago

I have an example with GPIO Pins which you can see here. Hope this helps someone.