How Play to audio list in os.startfile use Python?
MY CODE:
import os
music_dir = "C:\\Users\\JACKSON KASI\\Music"
songs = os.listdir(music_dir)
print(songs)
for i in songs:
os.startfile(os.path.join(music_dir,i))
The next audio file should run after the first audio file is fully functional. But my code is play all audio fast. It's not perfectly. someone help me please.
Do you can use pygame (OR) python-vlc use to solve this proplem.
os.startfile
is just launching the file asynchronously in the background. Per the docs:Basically, you can't use it for your purpose, because there's no way to know when it's done.
There are many, many walkthroughs for playing media files; please search the web for solutions (providing a complete solution from scratch is somewhat beyond the scope of a StackOverflow question).