So I’m not looking for anything fancy here, just a website that roblox can call to retrieve an audio id.
This is how I want it to work. The http picks from a list of given audio ids, and randomly chooses them, waits for the length of the song, and chooses another. Also, I can also interrupt the broadcast to play a specific audio.
Any roblox game with the key of the http can retrieve the audio id that’s playing, and play it in game.
Like an song station.
I don’t know how to do this, but I’ve done similar things before which is pretty easy.
I heard using glitch api can be useful as I don’t need to host a website, which I don’t even know how to do.
Another Feature I would like is intermissions between songs, like how music radios have “YOU’RE LI-LI-LI-LISTENING TO IHOP RADIO!!”
I’ve got a basic idea planned out that’s not pretty resource intensive, though this will be use for many servers in many games.
So whenever a song is over, new song plays, it sends an event in the http api, and the game that have it will listen to it like the how you can do it in roblox servers inside a single game. So, when an emergency i ntruption broadcast plays, it can also call out. To make this not call out at the same time in all of it, it will call out multiple times until all of the servers call back saying that they have the audio.
You won’t be able to sync this properly. If you change the audio on your external server, you will end up cutting off the ends of songs for people.
This is because both the Roblox server, and then the clients, need to load the sound. There is a delay here and the combination of the delay from your server to the Roblox server and then replicated to the client will introduce a few seconds at least, and potentially longer depending on how frequently you poll your web server.
You’re better off generating a long list of IDs that get sent over so the Roblox server has probably the next 20 songs or so, and possibly include timestamps of when you’d like the songs to play. That way on the Roblox side of things you can get clients to preload the tracks or at least make sure you aren’t drifting too far off your schedule.
For interruptions it is better for you to just have those included in the tracklist. Interrupting live for a prerecorded message seems like a waste as you’d have to poll your external server way more often.
With a generated tracklist you could go many minutes (maybe even hours) between calls to the external server to get the next lot of tracks to play. This is beneficial for everyone.
I still need to be able to make broadcasts and change the intermission audio from time to time…not to mention your post was pretty vague on how to do this
There are a million ways to do this. Being specific on one particular web host and one particular programming language and one particular database software would be pointless really.
The flow of information would be this:
Your Roblox game server starts up.
You perform and HTTP request to an external web server (set up by you). Whether that utilises a fancy API or is just a bog standard GET request on your top level domain - it doesn’t matter for the purposes of this instruction.
Your web server serves a pre-generated list of tracks cached to ensure all Roblox servers receive the same timestamped list. If no list exists, generate one that covers, for example, the next hour of programming. The valid tracks can be pulled from a database or similar. This is where you can change out intermissions, you could tag audio in your database to ensure certain types of tracks don’t go near each other, etc. Your external web server is your place to decide how the list is put together and generated - I can’t decide the order for you. Your intermissions should be added in with the track list and played as if they are just another track.
The returned list is then used to determine which track to play to get the server caught up - based on the current time (consider using os.time() to get the seconds since epoch) you may need to start on, for example, track 5 in the list, and you can even start half way through using TimePosition property of a Sound.
Once the track list is exhausted, repeat steps 2-4 to get more tracks to play.
I really can’t go any more specific than that without making all the decisions on the exact services to use. I don’t know how many game servers you plan to serve at once, how last minute you need your intermissions changed, etc. All I can say is that the farther in advance you can generate the tracklist, the better.