-
First of all - I really love this piece of software ❤️ Also, thanks for your feedback in the Slack channel.
The best solution for this would be to configure liquidsoap so that it only connects to the inputs when there are listeners connected. Here's the code I stitched together, I've trimmed it down so that it only contains one radio station and no fallback for now.
This is the log output when SONOS first tries to connect to the endpoint:
The Weirdly enough, it works when resuming playback, aka re-connecting:
still, Maybe there's there a better way to do this? 🤔 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi! That's a cool setup! You script is way too complicated! 😅 Here's an example of an on-demand harbor output coupled with a stream = input.http(start = false, "https://wwoz-sc.streamguys1.com/wwoz-hi.mp3")
listeners_count = ref(0)
def on_connect(~headers, ~uri, ~protocol, _) =
listeners_count := !listeners_count + 1
if !listeners_count > 0 and not stream.is_started() then
log("Starting input")
stream.start()
end
end
def on_disconnect(_) =
listeners_count := !listeners_count - 1
if !listeners_count == 0 and stream.is_started() then
log("Stopping input")
stream.stop()
end
end
blank = single("/tmp/blank.mp3")
stream = fallback(track_sensitive=false, [stream, blank])
output.harbor(
%ffmpeg(format="mp3", %audio.copy),
format="audio/mpeg",
mount="relay",
on_connect=on_connect,
on_disconnect=on_disconnect,
stream) All you need to have is an encoded file that matches the audio format of your source, then the harbor output will start and stop the underlying input when listeners are connected. The |
Beta Was this translation helpful? Give feedback.
Hi! That's a cool setup!
You script is way too complicated! 😅 Here's an example of an on-demand harbor output coupled with a
input.http
: