Liquidsoap for Streaming #4197
-
Hi everyone, Thanks to @toots and @gAlleb for the script. I'm working with the script from this repository for my YouTube live streaming. I want to set up functionality to play requested tracks by viewers. If the requested track isn't already uploaded, I would like to upload it and play it immediately, similar to how AzuraCast works. Additionally, I want to integrate a chatbot to trigger the functions (skip, play, and add to queue). Here’s what I’m looking to do:
It would be much easier if there were a web UI similar to AzuraCast for managing these functions. I like AzuraCast, but I’m not sure if it can work with the ai-radio script while providing dynamic metadata display like Liquidsoap's ai-radio video canvas in real-time. I don't need any AI functionality from the script, just the canvas with dynamic real-time updates. Any help or advice would be greatly appreciated! Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi @WittyWidget
Here is a very quick example which uses Azuracast default
Example
# if your source is radio:
# Skip - will be available via http://localhost:8007/skip
def skipper(_)
radio.skip()
http.response(data="The current song was skipped!")
end
harbor.http.register.simple(port=8007, "/skip", skipper)
queue = request.queue()
radio = fallback(track_sensitive=true, [queue, radio])
def play(request)
fname = request.query["file"]
log.important("Requested file #{fname}.")
if file.exists(fname) then
log.important("File Request Accepted.")
queue.push.uri("#{fname}")
http.response(content_type="text/html", status_code=200, data="<p>Request pushed.</p>")
else
log.important("File Request Rejected File Not Found.")
http.response(content_type="text/html", status_code=404, data="<p>Invalid file: #{fname}</p>")
end
end
harbor.http.register.simple("/play", play, port=8007, method="GET")
# Play: Play a specific track immediately. Create an `interupting_queue`
# and push files via http://localhost:8007/play_now
interrupting_queue = request.queue()
radio = fallback(track_sensitive=false, [interrupting_queue, radio])
def play(request)
fname = request.query["file"]
log.important("Requested file #{fname}.")
if file.exists(fname) then
log.important("File Request Accepted.")
interrupting_queue.push.uri("#{fname}")
http.response(content_type="text/html", status_code=200, data="<p>Request pushed.</p>")
else
log.important("File Request Rejected File Not Found.")
http.response(content_type="text/html", status_code=404, data="<p>Invalid file: #{fname}</p>")
end
end
harbor.http.register.simple("/play_now", play, port=8007, method="GET")
And so on.
So everything is relatively easy if you you are eager to invest some time and learn something new. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, @gAlleb, for the answer. I just tested the harbor functions (skip, play, and play_now). They are working, but not quite like in Azuracast. There's a delay of 10-15 seconds for skip and 7 seconds for play_now, whereas in Azuracast, the skip/play happens immediately. Does Azuracast have any separate configuration for that? Thank you again for helping the community. |
Beta Was this translation helpful? Give feedback.
-
Dear @gAlleb,
Liquidsoap code for AzuraCast - RTMP Video Stream
Now, I have tested the built-in 'Skip' button available on the AzuraCast web interface, which instantly triggers the current track to skip. However, when using standalone Liquidsoap (ai-radio), there is a delay of 10-15 seconds with the harbor/telnet functions. My apologies, I'm trying to understand the code, but I'm getting stuck. Do you have a full template (ai-radio) canvas for AzuraCast configuration? The provided template only displays the album cover and progress bar. The AzuraCast method seems easier. I would be grateful if you could upload the full template for AzuraCast Users in your repository. Many thanks! |
Beta Was this translation helpful? Give feedback.
Hi @WittyWidget
Edit Liquidsoap Configuration
and adding necessary code there) and use its UI and queuing mechanisms to queue tracks.So it's definitely a good option if you want to save time. Usually "videocode" is pasted into the last box of
Edit Liquidsoap Configuration
.Here is a very quick example which uses Azuracast default
radio
source, which can be pasted into the last box of theEdit Liquidsoap Configuration
of your Azuracast station.