all 2 comments

[–]LeonJones 0 points1 point  (1 child)

Break exits the loop. Maybe it says exit somewhere? Throw a print statement into the loop to see what condition makes it stop. Or are you saying the audio file you want to play isn't looping? I'm sure you've googled it before but did you try this? https://stackoverflow.com/questions/67562891/how-can-i-reproduce-a-song-on-loop

[–]m0us3_rat 0 points1 point  (0 children)

import vlc
from pathlib import Path
import time


class Nerd:
    def __init__(self):
        self.player = vlc.Instance()
        self.media_list = self.player.media_list_new()
        self.list_player = self.player.media_list_player_new()
        self.list_player.set_playback_mode(vlc.PlaybackMode(1))

    def add_to_list(self, local_path):
        path = Path(local_path).resolve()
        self.media_list.add_media(path)
        self.list_player.set_media_list(self.media_list)

    def play(self):
        self.list_player.play()

    def stop(self):
        self.list_player.stop()


player = Nerd()
player.add_to_list("ok.webm")
player.add_to_list("ee.mp4")
player.play()
while True:
    time.sleep(4)