savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.42k stars 130 forks source link

Dynamically change input.http URL using interactive.string #1084

Closed DaneStreeter closed 4 years ago

DaneStreeter commented 4 years ago

Is your feature request related to a problem? Please describe. The feature request is related to a current lack of functionality to interactively update a URL parameter for input.http.

Describe the solution you'd like The ability to update the (url) of each input.http source using interactive.string in the input. i.e. source = input.http(interactive.string) or something similar.

Describe alternatives you've considered I've tried all queue options, however, these only allow for on-demand content, not live http streams.

Additional context I am posting this here as per Romain's request on the #help slack channel (Friday 31st Jan 2020)

The use-case for the functionality is so that a central live stream producer can switch between external live streams on the fly. The specific use case is for events where there are several locations of broadcast but not all broadcasts come from the same production company or geographic location and can only contribute to 3rd party ICY/Shoutcast services.

toots commented 4 years ago

Hi! The url parameter in input.http is now a string getter in the later master. That means that you should be able to pass any function that generates a url. url is generated each time the operator goes into a new polling cycle.

steveybb commented 4 years ago

which version do I need to use this please?

toots commented 4 years ago

That would be the current master only for now, it should come with 2.0.0 some time in the future.

Tampa commented 5 months ago

How exactly does this work now? Just putting the variable into the input.http loads the defined default, but changing it via telnet the output doesn't switch to the new url. Is a function required for that?

I tried:

stream13amp = interactive.float("stream13amp", 0.35) stream13 = interactive.string("stream13", "")

def getstreamurl(stream) newstream = stream() newstream end

input13 = amplify(stream13amp, input.http(getstreamurl(stream13)))

But if I change the string for the url nothing happens, just getting silence. Why is that? How should switching the url be done?