Page 1 of 1

Busy Waiting in VLC

Posted: 27 Aug 2024 11:48
by JuneTooJuly
I'm trying to make a script to play a random song from each playlist, then loop.

Code: Select all

function descriptor() return { title = "Atomic Radio test"; } end function play_random_song(pathTo) vlc.playlist.clear() vlc.playlist.add({{path = pathTo}}) vlc.playlist.random("random") vlc.playlist.next() vlc.playlist.play() end function activate() vlc.msg.info("Atomic Radio extension activated!") local adList = "file:///C:/Users/JuneTooJuly/Desktop/AtomicRadio/adList.xspf" local musicList = "file:///C:/Users/JuneTooJuly/Desktop/AtomicRadio/atomicMusicList.xspf" local interMusicList = "file:///C:/Users/JuneTooJuly/Desktop/AtomicRadio/interMusicList.xspf" local introAdList = "file:///C:/Users/JuneTooJuly/Desktop/AtomicRadio/introAdList.xspf" local introMusicList = "file:///C:/Users/JuneTooJuly/Desktop/AtomicRadio/introMusicList.xspf" local currentTrackID = 0 while true do play_random_song(introMusicList) vlc.win.console_wait(15) play_random_song(musicList) vlc.win.console_wait(15) play_random_song(interMusicList) vlc.win.console_wait(15) play_random_song(musicList) vlc.win.console_wait(15) play_random_song(introAdList) vlc.win.console_wait(15) play_random_song(adList) vlc.win.console_wait(15) end end function deactivate() -- Stop playback when the script is deactivated vlc.playlist.stop() end
I removed the while loop for testing here, but every time I try to call anything related to .win, be it win.console_init() or win.console_wait([timeout]), VLC crashes. If anybody knows why it keeps crashing or has an alternative way to pause the lua script, I'd appreciate it.