You can stream audio from a URL. This is useful to play music directly from an internet radio, or stream a conference into your scene.
The audio in the source must be in one of the following formats:
aac. The source must also be an https URL (http URLs aren’t supported), and the source should have
CORS policies (Cross Origin Resource Sharing)
that permit externally accessing it. If this is not the case, you might need to set up a server to act as a proxy and expose the stream in a valid way.
📔 Note: To instead play a pre-recorded sound in your scene, see Sounds .
To add an audio stream into your scene, simply add an entity with an
const streamSource = new Entity() streamSource.addComponent( new AudioStream( "https://icecast.ravepartyradio.org/ravepartyradio-192.mp3" ) ) engine.addEntity(streamSource) streamSource.getComponent(AudioStream).playing = true
📔 Note: The streamed sound isn’t positional, it will be heard at a consistent volume throughout your entire scene. If a player steps out of the scene, they will not hear the streaming at all.
Set the volume of the
AudioStream component by changing its
AudioStream component on or off by setting its
playing property to true or false.