How to play music from a web radio ?

A new update is now available, introducing fishing, climbing gear, clothes and more!
Latest hotfix: 0.8.5.2 (2025-05-01)
  • For my plugin Radio, I try to play music from a webradio. But I can't get it to work. Can you help?


    Code
    webRadioAsset = SoundAsset.loadFromURL("http://icecast.radiofrance.fr/franceinfo-lofi.mp3");
    sound = player.playSound(webRadioAsset);
  • Thank you. It works. But the music doesn't follow the player and remains localized at the starting point.


    With an mp3, it's possible to simply play a track (without player.getPosition() ) and have that music as background music. Why doesn't it work with webradio?

  • Thank you. It works. But the music doesn't follow the player and remains localized at the starting point.


    With an mp3, it's possible to simply play a track (without player.getPosition() ) and have that music as background music. Why doesn't it work with webradio?

    Afaik the sound is an asset in a 3D space. So it has to "exist" within this 3D space.


    If you create an update loop and then periodically check the position of the player, you can then do a conditional check to see if the player has moved, then if they have moved, move the sound asset to the players new position.

    This will make the sound "follow" the player.

  • further reading threw the API you can assign null for position.

    Code
    sound = player.playSound(webRadioAsset, null);

    position - the world position of the sound. Provide null if you want to play this sound as a 2D sound instead (this means the sound has no actual position and can be heard everywhere).

  • Post by leviking ().

    This post was deleted by the author themselves: Correction, it does'nt work anyway. ().
  • Hey, sorry for responding so late! I can confirm that 2D sounds don't work properly with internet streams... honestly I'm not sure what's causing this (considering regular sound files play fine as 2D sounds) :thinking: It seems that this could be an internal FMOD error... anyway, we're still looking for a workaround, and hopefully we can provide a solution with one of the next hotfixes :)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!