Code:
import osimport timeimport subprocessimport RPi.GPIO as GPIOBUTTON_PIN = 17video_path = "/home/pi/media/video.mp4"waiting_screen_path = "/home/pi/Desktop/1.jpg"GPIO.setmode(GPIO.BCM)GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)def show_waiting_screen(): os.system("pkill vlc") os.system("pkill feh") time.sleep(1) os.system(f"feh --fullscreen {waiting_screen_path} &")def play_video(): video_process = subprocess.Popen( ["cvlc", "--fullscreen", "--no-video-title-show", video_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL ) video_process.wait() os.system("pkill feh")def main(): while True: show_waiting_screen() GPIO.wait_for_edge(BUTTON_PIN, GPIO.FALLING) play_video() show_waiting_screen()if __name__ == "__main__": try: main() except KeyboardInterrupt: pass finally: GPIO.cleanup()
Statistics: Posted by omar5858 — Fri Mar 14, 2025 12:36 pm