Preview:
"""
This example streams a playlist (.pls file) from an internet URL.
"""

import vlc


# URL to the .pls (playlist) file
playlist_url = "https://somafm.com/nossl/specials.pls"

# create a VLC instance and pass any VLC arguments you want to the new instance
# --intf dummy  is a dummy interface and this is used to run VLC in a headless mode
instance = vlc.Instance('--intf dummy')

player = instance.media_list_player_new()  # create a "media list" player for use with playlists

media = instance.media_list_new(playlist_url)  # create the media instance for the playlist

player.set_media_list(media)  # set what media instance you want to play

player.start()  # start the stream

player.pause()  # pause the stream

player.stop()  # stop the stream
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter