Last active
April 25, 2017 23:45
-
-
Save appendjeff/ec02d35ed0e9d810f1dc3f70150a2bc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from subprocess import Popen, PIPE | |
| import time | |
| import RPiGPIO as GPIO | |
| MY_VIDEO_FILE_PATH = '/home/video_name.mp4' | |
| my_process = Popen(['omxplayer', MY_VIDEO_FILE_PATH], stdin=PIPE, close_fds=True, bufsize=0) | |
| GPIO.setmode(GPIO.BCM) | |
| GPIO.setup(22,GPIO.IN,pull_up_down=GPIO.PUD_UP) | |
| while True: | |
| button_state = GPIO.input(22) | |
| if button_state == False: | |
| print('Quitting the player now') | |
| my_process.stdin.write('q') | |
| time.sleep(0.9) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See omxplayer documentation