VLC from Python reciving a stream

Viewed 18
  #!/usr/bin/python3
  import vlc
  p = vlc.MediaPlayer('https://stream.dxbh.net/AWR360Iloilo')
  p.play()

This is my python program. It does nothing. No error message. I am told the website is a shoutcast server. If I put the url in the browser, it works fine.

I am using Linux mint 20.3

I did pip install python-vlc

Any ideas what I am doing wrong?

It's not complicated. I got the code from SO. But there are no errors showing.

1 Answers

The program quits right after you start playing. It won't wait for your media to complete. You need to add something to wait. A minimal solution would be:

import time

while True:
    time.sleep(1)
Related