AudioManager class

Used to play audio.

Signature:

export declare class AudioManager extends ExternalObject 

Extends: ExternalObject

Remarks

Native html audio has many limitations as such all audio playback must go through this class instead. Use Runtime.getAudioManager() to get an instance of this class.

Methods

MethodModifiersDescription
load(url, mimeType, playOptions)Create an AudioClip that's ready to be played. Optionally plays the loaded audio clip on load. The clip is returned when ready to stream.

AudioManager.load() method

Create an AudioClip that's ready to be played. Optionally plays the loaded audio clip on load. The clip is returned when ready to stream.

Signature:

load(url: string, mimeType?: string, playOptions?: AudioPlayOptions): Promise<AudioClip>;

Parameters

ParameterTypeDescription
urlstringThe URL of the audio file to be played.
mimeTypestring(Optional) Provide the MIME type whenever possible, otherwise it will be guessed from the file name
playOptionsAudioPlayOptions(Optional) The initial playback parameters for an audio clip which are to be set when the audio finishes loading.

Returns:

Promise<AudioClip>

An audio clip that will play the specified audio file

Remarks

This call can take more than half a second to run, try to perform this operation behind the scenes