Skip to content

HTTP Audio Loading

Audio assets can be loaded over HTTP through the fetch JS API and are then made available to use, for example with AudioSource components.

Setting up HTTP Audio System

An HTTPAudioSystem can be set up by supplying a message bus and declaring the system.

new HTTPAudioSystem(messageBus);

Loading an Audio Asset

this.messageBus.Publish(Message.New<AudioRequest>(AudioRequest.MESSAGE_REQUEST_LOAD, new AudioRequest(

This loads the audio file assets/example.mp3 and saves it as asset name example. This allows the audio asset to be used throughout the system referred to as example.