How To

Mirror Engine API / Sound
Class: Sound
Represents the resource of an audio asset.
Constructors
new Sound()
new Sound(resource:
| AudioBuffer
| HTMLAudioElement): Sound
Create a new Sound instance.
Parameters
resource
If the Web Audio API is supported, pass an AudioBuffer object, otherwise an Audio object.
AudioBuffer
| HTMLAudioElement
Returns
Properties
audio
audio:
| undefined
| HTMLAudioElement;
If the Web Audio API is not supported this contains the audio data.
buffer
buffer:
| undefined
| AudioBuffer;
If the Web Audio API is supported this contains the audio data.
duration
Get Signature
get duration(): number
Gets the duration of the sound. If the sound is not loaded it returns 0.
Returns
number