Video in Loop + One Video on pressed Button
Posted: Tue Nov 18, 2014 8:31 am
Dear Community,
I need a simple Application which makes this possible:
One Video has to be played in loop - all the time using the omx player.
On pressing a Button using GPIO ANOTHER Video has to be played (a single time), after this video, the other looped video has to be player.
I wrote this script, but nothing happens by pressing the GPIO...
Is there someone who can help me?
I need a simple Application which makes this possible:
One Video has to be played in loop - all the time using the omx player.
On pressing a Button using GPIO ANOTHER Video has to be played (a single time), after this video, the other looped video has to be player.
I wrote this script, but nothing happens by pressing the GPIO...
Is there someone who can help me?
Code: Select all
import thread
import time
import RPi.GPIO as GPIO
import sys
import subprocess
import os
import glob
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.IN)
GPIO.setup(11, GPIO.OUT)
def hintergrund():
while True:
path ='/media/usb/Media/'
for infile in glob.glob(os.path.join(path, 'test.mp4')):
a = subprocess.call( [ "omxplayer", "-o", "hdmi", infile])
def front():
while True:
path ='/media/usb/Front/'
for infile in glob.glob(os.path.join(path, 'test.mp4')):
a = subprocess.call( [ "omxplayer", "-o", "hdmi", infile])
def gpio():
if GPIO.input(18) == 1:
return 1
else:
break
while True:
check = gpio()
if check == 1:
front()
else:
hintergrund()