[Release] [JS] Radio

FiveM Radio

This resource allows you to integrate your own radios in place of the original radios.
It’s fully written in JavaScript and uses resource metadata for its configuration.

Erratum: this resource uses a not-meant-to-be-exposed internal API surface. Don’t blame FiveM if this resource doesn’t work anymore after an update.

Last update: 22/12/2021

Features

  • Radio wheel
  • Audio file
  • Audio stream
  • No dependency
  • Easy configuration
  • Player-configurable volume

Showcase

Video showing Los Santos Rock Radio replaced by a WebRadio and Non-Stop-Pop FM replaced by a song:
Showcase

Known bugs and limitations

  • No MPEG or AAC support as CEF only supports open formats

Downloads

Archive: https://github.com/Hellslicer/fivem-radio/archive/master.zip
Source: GitHub - Hellslicer/fivem-radio: FXS Radio Resource

Configuration

For each custom radio, add this line in _resource.lua:

supersede_radio "[ORIGINAL_RADIO_NAME]" { url = "[RADIO URL]", volume = 0.5, name = "[NEW RADIO NAME]" }

You can find the list of radio names in data.js and a full example in fxmanifest.lua.

Tips

Stream a modified hud.ytd (gtav_radio_stations_texture_512) file to replace radio logos.

Changelog

2.0.1

  • Downgrade FXv2 version to bodacious to keep http streams compat

2.0.0

  • Update resource to FXv2
  • Update HowlerJS to 2.2.3

1.1.1

  • Update HowlerJS to 2.0.9
  • Fix custom radio volume regression

1.1.0

  • Add player-configurable volume
  • Fix some issues on resource initialization

1.0.0

  • Properly handle audio streams
  • Add an option to replace in-game radio name
  • Mute background radio radio when a custom one is playing

0.1.0

  • Radio wheel
  • Audio file and stream
46 Likes

Moved to #development:releases

1 Like

is it possible to stream a radio for example a stream??? or is that not possible? would be nice if you could stream actual radio sources via broadcasting your own radio for your server

2 Likes

Releases like this make me happy to have my own web server to put music for this on :stuck_out_tongue:

4 Likes

Yes, it’s possible and this is the main feature of this resource.
Check the __resource.lua file, it contains two example streams. You can replace these links by your own Webradio.

1 Like

haha holy shit, just yesterday i was saying to my other dev that it be sweet to have this, and now we have it, great release.

2 Likes

Thanks a lot for this awesome release, just tried it on my dev server using Linux FX server and it’s amazing;
But when using stream URLs like your example it works for about 1min30s then stops. Seems like a caching issue or so, if I restart the radio resource while server is up then music is back instantly. I have tried a lot of different stream url, same behavior everytime. Do you have any idea ?

Don’t know why it doesn’t work for me, just plays the default gta station rip.

4 Likes

anybody have URLS of live radio of los angeles or where I can fine them

1 Like

what else does it support then .ogg links ?

It’s a known problem that can be solved. I’ll fix it myself if nobody does it via PR (contribution).

Here is the list of supported audio codec formats:

  • FLAC
  • Opus
  • PCM 8-bit unsigned integer
  • PCM 16-bit signed integer little endian
  • PCM 32-bit float little endian
  • Vorbis
2 Likes

Thanks a lot, I tried to fix it myself but unfortunately was not able to.
Thank you for your prompt response and support.
And btw its not 1:30min but exactly 2:00min and also surprising is the fact that I had users in production that get no cuts…
For me even on a winodws or linux fivem server; same result.

@Hellslicer Is it possible to block all radios in the game? for authorized only ours?

One quick option that you have and which will not be the best one would be to replace all readios by yours. Sorry for this dirty method :wink:
Otherwise you override all radios with empty ones.
(told you real dirty method :wink: )

I get an error : Couldn’t load resource radio ( https://i.imgur.com/P1srcQa.png) .How do I solve it?

1 Like

Unfortunately I have no other solutions than those proposed by @tobias1

Hey Hellslicer, if you have an idea regarding the bug after 2min musics stops, can you please let me know how to solve it ?

Maybe add the radio resource to your resources folder ? :stuck_out_tongue:

Yep: track the currentTime and reset the audio source when it’s stuck.
Kinda dirty tho

Edit: A proper solution would be to use the onerror event, but for some reason it’s never trigerred.