[Release] [JS] Radio

I’m not entirely sure unfortunately, like, I had a few, then the URLs stopped working, but I’m happy to provide you and fellow UK listeners/fans with BBC1 Radio url! :stuck_out_tongue:

Here’s the code and formatting so you get an idea of how some stations do their stream URLs and what to look out for:

supersede_radio “RADIO_06_COUNTRY” { url = “https://stream.live.vc.bbcmedia.co.uk/bbc_radio_one”, volume = 0.4, name = “BBC Radio 1” }
supersede_radio “RADIO_07_DANCE_01” { url = “https://live.truckers.fm/”, volume = 0.2, name = “Truckers FM” }
supersede_radio “RADIO_12_REGGAE” { url = "https://19993.live.streamtheworld.com/WEB11_MP3_SC?", volume = 0.2, name = “SLAM! Hardstyle” }
supersede_radio “RADIO_22_DLC_BATTLE_MIX1_RADIO” { url = “https://simulatorradio.stream/stream”, volume = 0.2, name = “Simulator Radio” }

1 Like

@Hellslicer I’d like to appreciate you for accepting the pull request I’ve made to support mp3, and for the new Cayo Perico update radio station’s for your JavaScript radio, while AAC is actually supported in FiveM it causes a lot of performance issues client sided, and I never shoved that into the pull request, due to the amount of performance AAC takes, but sure do hope everyone does enjoys the update supporting mp3, and hope to keep contributing to the project.

Rickyisms

1 Like

does someone know how I can let this work with SetVehicleRadioLoud(vehicle, true)

sadly doesnt work for me

1 Like

Does anyone know what channel iFruit radio has. Seems it’s in none of the lists out there included and it seems it’s anywhere hidden. Testet all available stations, but no luck.
Would be nice if anyone could share it.

2 Likes

Hi everyone, how can we modify the trackid.gxt2 to modify the title of the songs displayed on five M? Thank you for your help

1 Like

Any ideas on how to get this to work with FiveM? I am assuming it is outdated?.. What an awesome script though!

can i use spotify playlist links for this?

It does work, you just have to have the correct radio stream link. You can see an example I posted above.

Do the radio stations need to .ogg, .mp3, .wav, etc?

I had luck with ogg, and some aac links.
The funny thing is, that at startup it send a error message that a link is broken, but ingame all links work.
You have to try multiple streaming links, so did I. Some will work and some don’t.
It’s pure luck I would say.
Only issue I have is, that the streams sometimes completely shut off. In that case I have to get out and into the car and it works again.

Apparently the javascript library needs changing and then you’ll be able to play other things like youtube, spotify, etc but i have no technical/coding knowledge of that.

This is also not my resource.

Open formats like Ogg or WebM would probably be preferable, because FiveM offers no guarantee of support for proprietary formats like MP3 or MP4, even though currently those are working with the version of Chromium that is included with FiveM. With streams though, you may not always have a choice.

It’s also not always obvious what format a stream is in, URLs don’t have to include a file extension like .ogg or .mp3. If you’re having trouble with a particular stream, if you provide the URL, someone may be able to take a look and see exactly what kind it is. The Developer Tools in web browsers like Chrome and Firefox can be used to extract more information. There’s a tab usually named Network that includes a list of all the resources a web page is using, if you find the stream URL there you can look at the HTTP response headers, which will include details like the Content-type header:

Some internet radio stations use segmented streams these days, most commonly with HTTP Live Streaming (HLS) which uses a .m3u8 playlist. I don’t believe the Javascript library JS Radio uses, Howler.js, supports this kind of stream currently. I made an experimental fork of this resource using the MediaElement.js library instead, which does support HLS streams and many other kinds of sources that you can’t just play in standard HTML5 <audio> tags: GitHub - kibook/fivem-radio: FXS Radio Resource. You’re welcome to try it and see if it helps with the streams you’re trying to use.

Note with streams, you’re always at the mercy of the site providing the stream. Some don’t expect or want you to use their streams this way, for example because their normal player on their website includes ads around it which makes them money, and by using the URL directly you are circumventing that. So I would not be surprised if some have measures to detect and cut off or limit connections that are not going through the official webpage, which might lead to some streams stopping or having issues playing consistently.

2 Likes

How tf can I set this up without creating a custom website and uploading my music to it? Any websites I can use with custom music?

"RADIO_23_DLC_XM19_RADIO",   		// iFruit Radio
1 Like

Is it possible to change the name of the song and author?

As far as I can tell, no. Because you would need to somehow get that meta information from the radio stations.

legend! Do you have a list will all radio stations as of Cayo Perico?

Currently not working for me.

Followed all the steps and it seems the resource doesn’t replace the default radio.

FiveM version: 2060
Radio stream: https://simulatorfm.stream/radio/8010/ogg or http://simulator-fm.stream:8080/stream.ogg

Try what @kibukj posted