API Documentation for: 0.4.0
Show:

Sound Class

Defined in: Sound:77
Module: SoundJS

The Sound class is the public API for creating sounds, controlling the overall sound levels, and managing plugins. All Sound APIs on this class are static.

Registering and Preloading
Before you can play a sound, it must be registered. You can do this with registerSound, or register multiple sounds using registerManifest. If you don't register them immediately, they will be automatically registered if you try and play a sound using play, or if you create a stopped sound using createInstance. If you use PreloadJS, this is handled for you when the sound is preloaded. It is recommended to preload sounds internally using the register functions or externally using PreloadJS so they are ready when you want to use them.

Playback
To play a sound once its been registered and preloaded, use the play method. This method returns a SoundInstance which can be paused, resumed, muted, etc. Please see the SoundInstance documentation for more on the instance control APIs.

Plugins
By default, the WebAudioPlugin or the HTMLAudioPlugin are used (when available), although developers can change plugin priority or add new plugins (such as the provided FlashPlugin). Please see the Sound API methods for more on the playback and plugin APIs. To install plugins, or specify a different plugin order, see Sound/installPlugins.

Example

 createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.FlashPlugin]);
 createjs.Sound.addEventListener("loadComplete", createjs.proxy(this.loadHandler, (this));
 createjs.Sound.registerSound("path/to/mySound.mp3|path/to/mySound.ogg", "sound");
 function loadHandler(event) {
     // This is fired for each sound that is registered.
     var instance = createjs.Sound.play("sound");  // play using id.  Could also use source.
     instance.addEventListener("playComplete", createjs.proxy(this.handleComplete, this));
     instance.setVolume(0.5);
 }

The maximum number of concurrently playing instances of the same sound can be specified in the "data" argument of registerSound.

 createjs.Sound.registerSound("sound.mp3", "soundId", 4);

Sound can be used as a plugin with PreloadJS to help preload audio properly. Audio preloaded with PreloadJS is automatically registered with the Sound class. When audio is not preloaded, Sound will do an automatic internal preload, and as a result, it may not play immediately the first time play is called. Use the loadComplete event to determine when a sound has finished internally preloading. It is recommended that all audio is preloaded before it is played.

 createjs.PreloadJS.installPlugin(createjs.Sound);

Known Browser and OS issues

IE 9 html audio quirk
Note in IE 9 there is a delay in applying volume changes to tags that occurs once playback is started. So if you have muted all sounds, they will all play during this delay until the mute applies internally. This happens regardless of when or how you apply the volume change, as the tag seems to need to play to apply it.

iOS 6 limitations

  • Sound is initially muted and will only unmute through play being called inside a user initiated event (touch).
  • Despite suggestions to the opposite, we have control over audio volume through our gain nodes.

More details: http://stackoverflow.com/questions/12517000/no-sound-on-ios-6-web-audio-api

Android limitations

  • Android chrome reports true when you run createjs.Sound.BrowserDetect.isChrome, but is a different browser with different abilities
  • We have no control over audio volume. Only the user can set volume on their device.
  • We can only play audio inside a user event (touch). This currently means you cannot loop sound.

Methods

addEventListener

(
  • type
  • listener
)
Function | Object

Adds the specified event listener.

Parameters:

  • type String

    The string type of the event.

  • listener Function | Object

    An object with a handleEvent method, or a function that will be called when the event is dispatched.

Returns:

Function | Object: Returns the listener for chaining or assignment.

beginPlaying

(
  • instance
  • [interrupt=none]
  • [offset]
  • [loop=0]
  • [volume]
  • [pan=instance.pan]
)
Boolean protected static

Defined in beginPlaying:1066

Begin playback. This is called immediately or after delay by playInstance.

Parameters:

  • instance SoundInstance

    A SoundInstance to begin playback.

  • [interrupt=none] String optional

    How this sound interrupts other instances with the same source. Defaults to Sound.INTERRUPTNONE. Interrupts are defined as INTERRUPTTYPE constants on Sound.

  • [offset] Number optional

    Time in milliseconds into the sound to begin playback. Defaults to the current value on the instance.

  • [loop=0] Number optional

    The number of times to loop the audio. Use 0 for no loops, and -1 for an infinite loop.

  • [volume] Number optional

    The volume of the sound between 0 and 1. Defaults to the current value on the instance.

  • [pan=instance.pan] Number optional

    The pan of the sound between -1 and 1. Defaults to current instance value.

Returns:

Boolean: If the sound can start playing. If there are no available channels, or the instance fails to start, this will return false.

createInstance

(
  • src
)
SoundInstance

Defined in createInstance:869

Available since 0.4.0

Creates a SoundInstance using the passed in src. If the src does not have a supported extension, a default SoundInstance will be returned that can be called safely but does nothing.

Parameters:

  • src String

    The src of the audio.

Returns:

SoundInstance: A SoundInstance that can be controlled after it is created. Unsupported extensions will return the default SoundInstance.

dispatchEvent

(
  • eventObj
  • [target]
)
Boolean

Dispatches the specified event.

Parameters:

  • eventObj Object | String

    An object with a "type" property, or a string type. If a string is used, dispatchEvent will contstruct a generic event object with "type" and "params" properties.

  • [target] Object optional

    The object to use as the target property of the event object. This will default to the dispatching object.

Returns:

Boolean: Returns true if any listener returned true.

getCapabilities

() Object static

Defined in getCapabilities:576

Get the active plugins capabilities, which help determine if a plugin can be used in the current environment, or if the plugin supports a specific feature. Capabilities include:

  • panning: If the plugin can pan audio from left to right
  • volume; If the plugin can control audio volume.
  • mp3: If MP3 audio is supported.
  • ogg: If OGG audio is supported.
  • wav: If WAV audio is supported.
  • mpeg: If MPEG audio is supported.
  • m4a: If M4A audio is supported.
  • mp4: If MP4 audio is supported.
  • aiff: If aiff audio is supported.
  • wma: If wma audio is supported.
  • mid: If mid audio is supported.
  • tracks: The maximum number of audio tracks that can be played back at a time. This will be -1 if there is no known limit.

Returns:

Object: An object containing the capabilities of the active plugin.

getCapability

(
  • key
)
Number | Boolean static

Defined in getCapability:604

Get a specific capability of the active plugin. See getCapabilities for a full list of capabilities.

Parameters:

  • key String

    The capability to retrieve

Returns:

Number | Boolean: The value of the capability.

getMute

() Boolean static

Defined in getMute:983

Available since 0.4.0

Returns the global mute value. To get the mute value of an individual instance, use SoundInstance getMute instead.

Returns:

Boolean: The mute value of Sound.

getPreloadHandlers

() Object protected static

Get the preload rules to allow Sound to be used as a plugin by PreloadJS. Any load calls that have the matching type or extension will fire the callback method, and use the resulting object, which is potentially modified by Sound. This helps when determining the correct path, as well as registering the audio instance(s) with Sound. This method should not be called, except by PreloadJS.

Returns:

Object: An object containing:
  • callback: A preload callback that is fired when a file is added to PreloadJS, which provides Sound a mechanism to modify the load parameters, select the correct file format, register the sound, etc.
  • types: A list of file types that are supported by Sound (currently supports "sound").
  • extensions A list of file extensions that are supported by Sound (see Sound.SUPPORTED_EXTENSIONS).

getSrcById

(
  • value
)
String protected static

Defined in getSrcById:1098

Get the source of a sound via the ID passed in with a register call. If no ID is found the value is returned instead.

Parameters:

  • value String

    The ID the sound was registered with.

Returns:

String: The source of the sound. Returns null if src has been registered with this id.

getVolume

() Number static

Defined in getVolume:929

Get the master volume of Sound. The master volume is multiplied against each sound's individual volume. To get individual sound volume, use SoundInstance getVolume instead.

Returns:

Number: The master volume, in a range of 0-1.

hasEventListener

(
  • type
)
Boolean

Indicates whether there is at least one listener for the specified event type.

Parameters:

  • type String

    The string type of the event.

Returns:

Boolean: Returns true if there is at least one listener for the specified event.

initialize

() protected

Inherited from EventDispatcher: initialize:98

Initialization method.

initializeDefaultPlugins

() Boolean private

Defined in initializeDefaultPlugins:543

Available since 0.4.0

Initialize the default plugins. This method is called when any audio is played before the user has registered any plugins, and enables Sound to work without manual plugin setup. Currently, the default plugins are WebAudioPlugin followed by HTMLAudioPlugin.

Returns:

Boolean: If a plugin is initialized (true) or not (false). If the browser does not have the capabilities to initialize any available plugins, this will return false.

initLoad

(
  • src
  • [type]
  • [id]
  • [data]
)
Boolean | Object protected static

Defined in initLoad:620

Process manifest items from PreloadJS. This method is intended for usage by a plugin, and not for direct interaction.

Parameters:

  • src String | Object

    The src or object to load. This is usually a string path, but can also be an HTMLAudioElement or similar audio playback object.

  • [type] String optional

    The type of object. Will likely be "sound" or null.

  • [id] String optional

    An optional user-specified id that is used to play sounds.

  • [data] Number | String | Boolean | Object optional

    Data associated with the item. Sound uses the data parameter as the number of channels for an audio instance, however a "channels" property can be appended to the data object if this property is used for other information. The audio channels will default to 1 if no value is found.

Returns:

Boolean | Object: An object with the modified values of those that were passed in, or false if the active plugin can not play the audio type.

isReady

() Boolean static

Defined in isReady:566

Determines if Sound has been initialized, and a plugin has been activated.

Returns:

Boolean: If Sound has initialized a plugin.

loadComplete

(
  • src
)
Boolean

Defined in loadComplete:769

Available since 0.4.0

Check if a source has been loaded by internal preloaders. This is necessary to ensure that sounds that are not completed preloading will not kick off a new internal preload if they are played.

Parameters:

  • src String

    The src or id that is being loaded.

Returns:

Boolean: If the src is already loaded.

mute

(
  • value
)
deprecated static

Defined in mute:940

Deprecated: This function has been deprecated. Please use setMute instead.

Mute/Unmute all audio. Please see setMute.

Parameters:

  • value Boolean

    Whether the audio should be muted or not.

parsePath

(
  • value
  • [type]
  • [id]
  • [data]
)
Object protected

Defined in parsePath:787

Parse the path of a sound, usually from a manifest item. Manifest items support single file paths, as well as composite paths using Sound.DELIMITER, which defaults to "|". The first path supported by the current browser/plugin will be used.

Parameters:

  • value String

    The path to an audio source.

  • [type] String optional

    The type of path. This will typically be "sound" or null.

  • [id] String optional

    The user-specified sound ID. This may be null, in which case the src will be used instead.

  • [data] Number | String | Boolean | Object optional

    Arbitrary data appended to the sound, usually denoting the number of channels for the sound. This method doesn't currently do anything with the data property.

Returns:

Object: A formatted object that can be registered with the Sound.activePlugin and returned to a preloader like PreloadJS.

play

(
  • src
  • [interrupt="none"]
  • [delay=0]
  • [offset=0]
  • [loop=0]
  • [volume=1]
  • [pan=0]
)
SoundInstance static

Defined in play:830

Play a sound and get a SoundInstance to control. If the sound fails to play, a SoundInstance will still be returned, and have a playState of Sound.PLAY_FAILED. Note that even on sounds with failed playback, you may still be able to call SoundInstance play, since the failure could be due to lack of available channels. If there is no available plugin, Sound.defaultSoundInstance will be returned, which will not play any audio, but will not generate errors.

Example

 createjs.Sound.registerSound("myAudioPath/mySound.mp3", "myID", 3);
 // wait until load is complete
 createjs.Sound.play("myID");
 // alternately we could call the following
 var myInstance = createjs.Sound.play("myAudioPath/mySound.mp3", createjs.Sound.INTERRUPT_ANY, 0, 0, -1, 1, 0);

Parameters:

  • src String

    The src or ID of the audio.

  • [interrupt="none"] String optional

    How to interrupt other instances of audio. Values are defined as INTERRUPT_TYPE constants on the Sound class.

  • [delay=0] Number optional

    The amount of time to delay the start of the audio in milliseconds.

  • [offset=0] Number optional

    The point to start the audio in milliseconds.

  • [loop=0] Number optional

    How many times the audio loops when it reaches the end of playback. The efault is 0 (no loops), and -1 can be used for infinite playback.

  • [volume=1] Number optional

    The volume of the sound, between 0 and 1. Note that the master volume is applied against the individual volume.

  • [pan=0] Number optional

    The left-right pan of the sound (if supported), between -1 (left) and 1 (right).

Returns:

SoundInstance: A SoundInstance that can be controlled after it is created.

playFinished

(
  • instance
)
protected static

Defined in playFinished:1114

A sound has completed playback, been interrupted, failed, or been stopped. This method removes the instance from Sound management. It will be added again, if the sound re-plays. Note that this method is called from the instances themselves.

Parameters:

playInstance

(
  • instance
  • [interrupt=none]
  • [delay=0]
  • [offset=instance.offset]
  • [loop=0]
  • [volume]
  • [pan]
)
Boolean protected static

Defined in playInstance:1012

Play an instance. This is called by the static API, as well as from plugins. This allows the core class to control delays.

Parameters:

  • instance SoundInstance

    The SoundInstance to start playing.

  • [interrupt=none] String optional

    How this sound interrupts other instances with the same source. Defaults to Sound.INTERRUPTNONE. All interrupt values are defined as INTERRUPTTYPEconstants on Sound.

  • [delay=0] Number optional

    Time in milliseconds before playback begins.

  • [offset=instance.offset] Number optional

    Time into the sound to begin playback in milliseconds. Defaults to the current value on the instance.

  • [loop=0] Number optional

    The number of times to loop the audio. Use 0 for no loops, and -1 for an infinite loop.

  • [volume] Number optional

    The volume of the sound between 0 and 1. Defaults to current instance value.

  • [pan] Number optional

    The pan of the sound between -1 and 1. Defaults to current instance value.

Returns:

Boolean: If the sound can start playing. Sounds that fail immediately will return false. Sounds that have a delay will return true, but may still fail to play.

proxy

(
  • method
  • scope
)
deprecated protected static

Defined in proxy:1131

Deprecated: Deprecated in favor of createjs.proxy.

A function proxy for Sound methods. By default, JavaScript methods do not maintain scope, so passing a method as a callback will result in the method getting called in the scope of the caller. Using a proxy ensures that the method gets called in the correct scope.

Parameters:

  • method Function

    The function to call

  • scope Object

    The scope to call the method name on

registerManifest

(
  • manifest
)
Object static

Defined in registerManifest:738

Available since 0.4.0

Register a manifest of sounds to playback in Sound. It is recommended to register all sounds that need to be played back in order to properly prepare and preload them. Sound does internal preloading when required.

Example

 var manifest = [
     {src:"assetPath/asset0.mp3|assetPath/asset0.ogg", id:"example"}, // Note the Sound.DELIMITER
     {src:"assetPath/asset1.mp3|assetPath/asset1.ogg", id:"1", data:6},
     {src:"assetPath/asset2.mp3", id:"works"}
 ];
 createjs.Sound.addEventListener("loadComplete", doneLoading); // call doneLoading when each sound loads
 createjs.Sound.registerManifest(manifest);

Parameters:

  • manifest Array

    An array of objects to load. Objects are expected to be in the format needed for registerSound: {src:srcURI, id:ID, data:Data, preload:UseInternalPreloader} with "id", "data", and "preload" being optional.

Returns:

Object: An array of objects with the modified values that were passed in, which defines each sound. It will return false for any values that the source cannot be parsed.

registerPlugin

(
  • plugin
)
Boolean static

Defined in registerPlugin:491

Register a Sound plugin. Plugins handle the actual playback of audio. The default plugins are (WebAudioPlugin followed by the HTMLAudioPlugin), and are installed if no other plugins are present when the user starts playback.

Example

 createjs.FlashPlugin.BASE_PATH = "../src/SoundJS/";
 createjs.Sound.registerPlugin(createjs.FlashPlugin);

To register multiple plugins, use registerPlugins.

Parameters:

  • plugin Object

    The plugin class to install.

Returns:

Boolean: Whether the plugin was successfully initialized.

registerPlugins

(
  • plugins
)
Boolean static

Defined in registerPlugins:520

Register a list of Sound plugins, in order of precedence. To register a single plugin, use registerPlugin.

Example

 createjs.FlashPlugin.BASE_PATH = "../src/SoundJS/";
 createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]);

Parameters:

  • plugins Array

    An array of plugins classes to install.

Returns:

Boolean: Whether a plugin was successfully initialized.

registerSound

(
  • src
  • [id]
  • [data]
  • [preload=true]
)
Object static

Defined in registerSound:644

Available since 0.4.0

Register a sound to playback in Sound. This is automatically called when using PreloadJS, however if you just wish to register a sound manually, this method will handle it. It is recommended to register all sounds that need to be played back in order to properly prepare and preload them. Sound does internal preloading when required.

Example

 createjs.Sound.registerSound("myAudioPath/mySound.mp3|myAudioPath/mySound.ogg", "myID", 3);

Parameters:

  • src String | Object

    The source or an Objects with a "src" property

  • [id] String optional

    An id specified by the user to play the sound later.

  • [data] Number | Object optional

    Data associated with the item. Sound uses the data parameter as the number of channels for an audio instance, however a "channels" property can be appended to the data object if it is used for other information. The audio channels will set a default based on plugin if no value is found.

  • [preload=true] Boolean optional

    If the sound should be internally preloaded so that it can be played back without an external preloader.

Returns:

Object: An object with the modified values that were passed in, which defines the sound. Returns false if the source cannot be parsed.

removeAllEventListeners

(
  • [type]
)

Removes all listeners for the specified type, or all listeners of all types.

Parameters:

  • [type] String optional

    The string type of the event. If omitted, all listeners for all types will be removed.

removeEventListener

(
  • type
  • listener
)

Removes the specified event listener.

Parameters:

  • type String

    The string type of the event.

  • listener Function | Object

    The listener function or object.

sendLoadComplete

(
  • src
)
private static

Defined in sendLoadComplete:443

Available since 0.4.0

Parameters:

  • src String

    A sound file has completed loading, and should be dispatched.

setMute

(
  • value
)
Boolean static

Defined in setMute:957

Available since 0.4.0

Mute/Unmute all audio. Note that muted audio still plays at 0 volume. This global mute value is maintained separately and will override, but not change the mute property of individual instances. To mute an individual instance, use SoundInstance SoundInstance/setMute instead.

Parameters:

  • value Boolean

    Whether the audio should be muted or not.

Returns:

Boolean: If the mute was set.

setVolume

(
  • value
)
static

Defined in setVolume:908

Set the master volume of Sound. The master volume is multiplied against each sound's individual volume. To set individual sound volume, use SoundInstance setVolume instead.

Parameters:

  • value Number

    The master volume value. The acceptable range is 0-1.

stop

() static

Defined in stop:995

Stop all audio (global stop). Stopped audio is reset, and not paused. To play back audio that has been stopped, call SoundInstance.play.

toString

() String

Inherited from EventDispatcher: toString:191

Returns:

String: a string representation of the instance.

Properties

_listeners

Object protected

Inherited from EventDispatcher: _listeners:90

activePlugin

Object static

Defined in activePlugin:318

The currently active plugin. If this is null, then no plugin could be initialized. If no plugin was specified, Sound attempts to apply the default plugins: WebAudioPlugin, followed by HTMLAudioPlugin.

AUDIO_TIMEOUT

Number static

Defined in AUDIO_TIMEOUT:162

The duration in milliseconds to determine a timeout.

Default: 8000

defaultInterruptBehavior

String static

Defined in defaultInterruptBehavior:296

Available since 0.4.0

Determines the default behavior for interrupting other currently playing instances with the same source, if the maximum number of instances of the sound are already playing. Currently the default is Sound.INTERRUPT_NONE but this can be set and will change playback behavior accordingly. This is only used if play is called without passing a value for interrupt.

Default: none

defaultSoundInstance

Object protected static

An object that stands in for audio that fails to play. This allows developers to continue to call methods on the failed instance without having to check if it is valid first. The instance is instantiated once, and shared to keep the memory footprint down.

DELIMITER

String static

Defined in DELIMITER:153

The character (or characters) that are used to split multiple paths from an audio source.

Default: |

EXTENSION_MAP

Object

Defined in EXTENSION_MAP:274

Available since 0.4.0

Some extensions use another type of extension support to play (one of them is a codex). This allows you to map that support so plugins can accurately determine if an extension is supported. Adding to this list can help plugins determine more accurately if an extension is supported.

FILE_PATTERN

RegExp private static

Defined in FILE_PATTERN:286

The RegExp pattern to use to parse file URIs. This supports simple file names, as well as full domain URIs with query strings. The resulting match is: protocol:$1 domain:$2 path:$3 file:$4 extension:$5 query string:$6.

idHash

Object private static

Defined in idHash:376

A hash lookup of sound sources via the corresponding ID.

instances

Array private static

Defined in instances:363

An array containing all currently playing instances. This helps Sound control the volume, mute, and playback of all instances when using static APIs like stop and setVolume. When an instance has finished playback, it gets removed via the Sound/finishedPlaying method. If the user replays an instance, it gets added back in via the beginPlaying method.

INTERRUPT_ANY

String static

Defined in INTERRUPT_ANY:171

The interrupt value to interrupt any currently playing instance with the same source, if the maximum number of instances of the sound are already playing.

Default: any

INTERRUPT_EARLY

String static

Defined in INTERRUPT_EARLY:181

The interrupt value to interrupt the earliest currently playing instance with the same source that progressed the least distance in the audio track, if the maximum number of instances of the sound are already playing.

Default: early

INTERRUPT_LATE

String static

Defined in INTERRUPT_LATE:191

The interrupt value to interrupt the currently playing instance with the same source that progressed the most distance in the audio track, if the maximum number of instances of the sound are already playing.

Default: late

INTERRUPT_NONE

String static

Defined in INTERRUPT_NONE:201

The interrupt value to interrupt no currently playing instances with the same source, if the maximum number of instances of the sound are already playing.

Default: none

lastID

Number private static

Defined in lastID:309

Used internally to assign unique IDs to each SoundInstance

masterMute

Boolean private static

Defined in masterMute:351

Available since 0.4.0

The master mute value for Sound. This is applies to all sound instances. This value can be set through setMute and accessed via getMute.

Default: false

masterVolume

Number private

Defined in masterVolume:340

Available since 0.4.0

The master volume value. Use getVolume and setVolume to modify the volume of all audio.

Default: 1

onLoadComplete

Function deprecated

Defined in onLoadComplete:434

Deprecated: In favour of the "loadComplete" event. Will be removed in a future version.

Available since 0.4.0

The callback that is fired when a file finishes loading internally.

PLAY_FAILED

String static

Defined in PLAY_FAILED:248

Defines the playState of an instance that failed to play. This is usually caused by a lack of available channels when the interrupt mode was "INTERRUPT_NONE", the playback stalled, or the sound could not be found.

Default: playFailed

PLAY_FINISHED

String static

Defined in PLAY_FINISHED:239

Defines the playState of an instance that completed playback.

Default: playFinished

PLAY_INITED

String static

Defined in PLAY_INITED:212

Defines the playState of an instance that is still initializing.

Default: playInited

PLAY_INTERRUPTED

String static

Defines the playState of an instance that was interrupted by another instance.

Default: playInterrupted

PLAY_SUCCEEDED

String static

Defined in PLAY_SUCCEEDED:221

Defines the playState of an instance that is currently playing or paused.

Default: playSucceeded

pluginsRegistered

Boolean private static

Determines if the plugins have been registered. If false, the first call to play() will instantiate the default plugins (WebAudioPlugin, followed by HTMLAudioPlugin). If plugins have been registered, but none are applicable, then sound playback will fail.

Default: false

preloadHash

Object private static

Defined in preloadHash:385

A hash lookup of preloading sound sources via the parsed source that is passed to the plugin. Contains the source, id, and data that was passed in by the user. Parsed sources can contain multiple instances of source, id, and data.

SUPPORTED_EXTENSIONS

ArrayString

A list of the default supported extensions that Sound will try to play. Plugins will check if the browser can play these types, so modifying this list before a plugin is initialized will allow the plugins to try and support additional media types.

NOTE this does not currently work for FlashPlugin.

More details on file formats can be found at http://en.wikipedia.org/wiki/Audiofileformat. A very detailed list of file formats can be found //http://www.fileinfo.com/filetypes/audio. A useful list of extensions for a format can be found at http://html5doctor.com/html5-audio-the-state-of-play/

Default: ["mp3", "ogg", "mpeg", "wav", "m4a", "mp4", "aiff", "wma", "mid"]

Events

loadComplete

Defined in loadComplete:420

Available since 0.4.0

This event that is fired when a file finishes loading internally. This event is fired for each loaded sound, so any handler methods should look up the event.src to handle a particular sound.

Event Payload:

  • target Object

    The object that dispatched the event.

  • type String

    The event type.

  • src String

    The source of the sound that was loaded. Note this will only return the loaded part of a delimiter-separated source.

  • [id] String optional

    The id passed in when the sound was registered. If one was not provided, it will be null.

  • [data] Number | Object optional

    Any additional data associated with the item. If not provided, it will be undefined.