Readonlyautotrue to start playing immediate after load.
true if the buffer is loaded.
Readonlyistrue if the sound is currently being played.
The audio source
ReadonlyoptionsThe constructor options.
Readonlypreloadtrue to immediately start preloading.
true to disallow playing multiple layered instances at once.
ReadonlyurlThe file source to load.
Instance of the media context.
Get the duration of the audio in seconds.
Gets the list of instances that are currently being played of this sound.
If the current sound is playable (loaded).
Gets and sets the looping.
Gets and sets the muted flag.
Stops all the instances of this sound from playing.
The playback rate.
Get the map of sprites.
Gets and sets the volume.
Add a sound sprite, which is a saved instance of a longer sound. Similar to an image spritesheet.
The unique name of the sound sprite.
Either completed function or play options.
Convenience method to add more than one sprite add a time.
Map of sounds to add where the key is the alias, and the data are configuration options.
The map of sound sprites added.
Auto play the first instance.
Destructor, safer to use SoundLibrary.remove(alias) to remove this sound.
Stops all the instances of this sound from playing.
Play a sound sprite, which is a saved instance of a longer sound. Similar to an image spritesheet.
The unique name of the sound sprite.
Optionalcallback: CompleteCallbackCallback when completed.
The sound instance, this cannot be reused after it is done playing. Returns a Promise if the sound has not yet loaded.
Plays the sound.
Optionalsource: string | CompleteCallback | PlayOptionsEither completed function or play options.
Optionalcallback: CompleteCallbackCallback when completed.
The sound instance, this cannot be reused after it is done playing. Returns a Promise if the sound has not yet loaded.
Internal only, speed, loop, volume change occured.
Handle changes in paused state. Internal only.
Remove a sound sprite.
Optionalalias: stringThe unique name of the sound sprite, if alias is omitted, removes all sprites.
Resuming all the instances of this sound from playing
Stops all the instances of this sound from playing.
Staticfrom
Sound represents a single piece of loaded media. When playing a sound IMediaInstance objects are created. Properties such a
volume,pause,mute,speed, etc will have an effect on all instances.