I am working on my project that can display video when a magnet (signal ) is detected using a hall-effect sensor. Then after, if the magnet is removed from the sensor the video has to pause (not to terminate or stop). So can any one help me. I got the code to stop (terminate) the video but I am looking for a command that can pause my video with out using a keyboard. My python script is shown below. I have used the dbuscontrol.sh file to pause the video but for some reason it is not working. The video displays properly but the pause command doesn't work. Can some one give me any clues?
GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) hallpin = 18 sleepTime = 5 GPIO.setup( hallpin, GPIO.IN) video1 = ("/home/pi/Videos/myvideo.mp4") while True: if(GPIO.input(hallpin) == False): #print("magnet detected") omxc=subprocess.Popen(['omxplayer',video1],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE, close_fds=True) else: #print("magnet not detected") #os.system('killall omxplayer.bin') os.system('dbuscontrol.sh pause') sleep(sleepTime)