Reputation: 13
I need to open VLC and play video, depending on the variable "start". In this example, loop continues after ad1.mp4 finished. Is there a way, how to make loop not waiting? So ad1.mp4 start playing and loop will continue.
start = 1
while True:
if start == 1:
os.system("vlc --video ad/ad1.pm4")
if start == 2:
os.system("vlc --video ad/ad2.pm4")
.
.
.
Upvotes: 0
Views: 342
Reputation: 1195
You can use the subprocess library.
import subprocess
subprocess.Popen(["vlc","--video ","ad/ad1.pm4"])
This allows to spawn a new process and not making python to wait until it finishes.
Library link: https://docs.python.org/3/library/subprocess.html
Upvotes: 1