Internet Radio and More #2082
Krutonium
started this conversation in
Show and tell
Replies: 1 comment 4 replies
-
You can use -- Discover speakers
local speakers = {}
for _, side in ipairs(peripheral.getNames()) do
if peripheral.getType(side) == "speaker" then
table.insert(speakers, peripheral.wrap(side))
end
end
local function startRadio(stationUrl)
stopRadio()
local w, err = http.websocket(convertUrl)
w.send(stationUrl)
if not w then return end
ws = w
running = true
parallel.waitForAny(playAudio, receiveAudio)
end You need just fix a bit of your parallel logics parallel.waitForAny(
function()
while running do
playAudio()
end
end,
... will immediately exits because parallel.waitForAny(
function()
while true do
if running then
playAudio()
else
sleep(0)
end
end
end,
... |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have made a CC:T program and accompanying service that makes use of WebSockets, yt-dlp and ffmpeg to enable streaming of Live Music into the game via ComputerCraft, from YouTube, Twitch, Internet Radio Sources, basically anywhere you can get an audio feed.
https://github.com/Krutonium/InternetRadio2Computercraft
Tell me what you think (and also if you know how to unstuck the GUI!)
(I'll leave my reference server open at ws://krutonium.ca:2468 for a while for your use - Please don't abuse this, and host your own if you're planning to use it long term)
Beta Was this translation helpful? Give feedback.
All reactions