Hello!
I'm wanting to run a video with python but have it close if the program detects user input (of any kind). The issues that I have so far is that whenever I initiate the video the window that the video is running in is in focus. I use vlc player to run the video, so there is no way that my script can sense a key press (as the vlc window is in focus) and will only apply hotkey actions if one of those hotkeys are pressed while the video is playing.
I want to play a video, and upon user input it kills the video and stops the script. Does anyone have any ideas?
I'm not stuck on the idea of using vlc player. I just want to get this to work.
This is the code that I'm using so far. Everything works as intended except I have to click in the open terminal and press a key for the video to terminate.
I'm wanting to run a video with python but have it close if the program detects user input (of any kind). The issues that I have so far is that whenever I initiate the video the window that the video is running in is in focus. I use vlc player to run the video, so there is no way that my script can sense a key press (as the vlc window is in focus) and will only apply hotkey actions if one of those hotkeys are pressed while the video is playing.
I want to play a video, and upon user input it kills the video and stops the script. Does anyone have any ideas?
I'm not stuck on the idea of using vlc player. I just want to get this to work.
This is the code that I'm using so far. Everything works as intended except I have to click in the open terminal and press a key for the video to terminate.
import os import tty import sys import pygame tty.setraw(sys.stdin.fileno()) key = 'n' if key == 'n': os.system("vlc /home/user/Intro.mpg &") os.system("") key = sys.stdin.read(1) if(key != 'n'): os.system("killall vlc")