Skip to content Skip to sidebar Skip to footer

Python-vlc Doesn't Play Audio/video From .py File

I want to make mediaplayer, I choosed python-vlc library, but I don't know why I can't play audio/video from .py file. If I tried make it with cmd and Python Shell all working: >

Solution 1:

After some research, you need to add a infinite loop or the delay while you want your song on.

For example if you want 10s of music :

import vlc
import time

p = vlc.MediaPlayer(r"C:\Users\username\Downloads\test.mp3")
p.play()

time.sleep(10)

or

import vlc

p = vlc.MediaPlayer(r"C:\Users\username\Downloads\test.mp3")
p.play()

whileTrue:
     pass

Post a Comment for "Python-vlc Doesn't Play Audio/video From .py File"