Closed darrell24015 closed 7 years ago
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.
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() `
lsb_release -a
Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie
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
Would like to be able to pause and then reset the video with a second button press, or stop the video with the KeyboardInterrupt
Did you manage to produce a working example @darrell24015? If so I'm sure others would appreciate it if you could share it :)
I have an example with GPIO Pins which you can see here. Hope this helps someone.
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
lsb_release -a
):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