Play sounds using Web Audio in the browser. The WebAudioPlugin is currently the default plugin, and will be used anywhere that it is supported. To change plugin priority, check out the Sound API registerPlugins method.
Webkit (Chrome and Safari)
iOS 6 limitations
_addPropsToClasses
Defined in
_addPropsToClasses:422
Available since 0.6.0
Set up needed properties on supported classes WebAudioSoundInstance and WebAudioLoader.
_compatibilitySetUp
Defined in
_compatibilitySetUp:363
Available since 0.4.2
Set up compatibility if only deprecated web audio calls are supported. See http://www.w3.org/TR/webaudio/#DeprecationNotes Needed so we can support new browsers that don't support deprecated calls (Firefox) as well as old browsers that don't support new calls.
_createAudioContext
Defined in
_createAudioContext:326
Available since 1.0.0
Create an audio context for the sound.
This method handles both vendor prefixes (specifically webkit support), as well as a case on iOS where audio played with a different sample rate may play garbled when first started. The default sample rate is 44,100, however it can be changed using the WebAudioPlugin/DEFAULT_SAMPLE_RATE:property.
_generateCapabilities
Defined in
_generateCapabilities:273
Determine the capabilities of the plugin. Used internally. Please see the Sound API capabilities method for an overview of plugin capabilities.
_handlePreloadCompleteevent
Inherited from
AbstractPlugin:
_handlePreloadComplete:280
Handles internal preload completion.
event
Object
_handlePreloadErrorevent
Inherited from
AbstractPlugin:
_handlePreloadError:302
Handles internal preload errors
event
Object
_isFileXHRSupported
Defined in
_isFileXHRSupported:240
Available since 0.4.2
Determine if XHR is supported, which is necessary for web audio.
If XHR is supported.
_unlock
Defined in
_unlock:391
Available since 0.6.2
Try to unlock audio on iOS. This is triggered from either WebAudio plugin setup (which will work if inside of
a mousedown or touchend event stack), or the first document touchend/mousedown event. If it fails (touchend
will fail if the user presses for too long, indicating a scroll event instead of a click event.
Note that earlier versions of iOS supported touchstart for this, but iOS9 removed this functionality. Adding
a touchstart event to support older platforms may preclude a mousedown even from getting fired on iOS9, so we
stick with mousedown and touchend.
_updateVolumeInherited from
AbstractPlugin
but overwritten in
_updateVolume:440
Set the gain value for master audio. Should not be called externally.
createsrc
startTime
duration
Inherited from
AbstractPlugin:
create:213
Create a sound instance. If the sound has not been preloaded, it is internally preloaded here.
A sound instance for playback and control.
getVolumeInherited from
AbstractPlugin:
getVolume:252
Get the master volume of the plugin, which affects all SoundInstances.
The volume level, between 0 and 1.
isPreloadCompletesrc
Inherited from
AbstractPlugin:
isPreloadComplete:175
Checks if preloading has finished for a specific source.
src
String
The sound URI to load.
isPreloadStartedsrc
Inherited from
AbstractPlugin:
isPreloadStarted:164
Checks if preloading has started for a specific source. If the source is found, we can assume it is loading, or has already finished loading.
src
String
The sound URI to check.
isSupported
Defined in
isSupported:198
Determine if the plugin can be used in the current browser/OS.
If the plugin can be initialized.
playEmptySound
Defined in
playEmptySound:214
Available since 0.4.1
Plays an empty sound in the web audio context. This is used to enable web audio on iOS devices, as they require the first sound to be played inside of a user initiated event (touch/click). This is called when WebAudioPlugin is initialized (by Sound initializeDefaultPlugins for example).
function handleTouch(event) {
createjs.WebAudioPlugin.playEmptySound();
}
preloadloader
Inherited from
AbstractPlugin:
preload:154
Internally preload a sound.
loader
Loader
The sound URI to load.
registerloadItem
Inherited from
AbstractPlugin:
register:132
Pre-register a sound for preloading and setup. This is called by Sound.
Note all plugins provide a Loader instance, which PreloadJS
can use to assist with preloading.
loadItem
String
An Object containing the source of the audio Note that not every plugin will manage this value.
A result object, containing a "tag" for preloading purposes.
removeAllSoundssrc
Inherited from
AbstractPlugin:
removeAllSounds:202
Remove all sounds added using WebAudioPlugin/register. Note this does not cancel a preload.
src
String
The sound URI to unload.
removeSoundsrc
Inherited from
AbstractPlugin:
removeSound:185
Remove a sound added using WebAudioPlugin/register. Note this does not cancel a preload.
src
String
The sound URI to unload.
setMutevalue
Inherited from
AbstractPlugin:
setMute:261
Mute all sounds via the plugin.
If the mute call succeeds.
setVolumevalue
Inherited from
AbstractPlugin:
setVolume:239
Set the master volume of the plugin, which affects all SoundInstances.
value
Number
The volume to set, between 0 and 1.
If the plugin processes the setVolume call (true). The Sound class will affect all the instances manually otherwise.
_audioSourcesInherited from
AbstractPlugin:
_audioSources:65
Object hash indexed by the source URI of each file to indicate if an audio source has begun loading, is currently loading, or has completed loading. Can be used to store non boolean data after loading is complete (for example arrayBuffers for web audio).
_capabilities
Defined in
_capabilities:131
The capabilities of the plugin. This is generated via the _generateCapabilities method and is used internally.
Default: null
_panningModel
Defined in
_panningModel:82
Value to set panning model to equal power for WebAudioSoundInstance. Can be "equalpower" or 0 depending on browser implementation.
_panningModel
Defined in
_panningModel:142
Value to set panning model to equal power for WebAudioSoundInstance. Can be "equalpower" or 0 depending on browser implementation.
_scratchBuffer
Defined in
_scratchBuffer:164
The scratch buffer that will be assigned to the buffer property of a source node on close. Works around an iOS Safari bug: https://github.com/CreateJS/SoundJS/issues/102
Advanced users can set this to an existing source node, but must do so before they call registerPlugins or initializeDefaultPlugins.
_unlocked
Defined in
_unlocked:178
Available since 0.6.2
Indicated whether audio on iOS has been unlocked, which requires a touchend/mousedown event that plays an empty sound.
_volumeInherited from
AbstractPlugin:
_volume:83
The internal master volume value of the plugin.
Default: 1
context
Defined in
context:90
The web audio context, which WebAudio uses to play audio. All nodes that interact with the WebAudioPlugin need to be created within this context.
context
Defined in
context:151
The web audio context, which WebAudio uses to play audio. All nodes that interact with the WebAudioPlugin need to be created within this context.
Advanced users can set this to an existing context, but must do so before they call registerPlugins or initializeDefaultPlugins.
DEFAULT_SAMPLE_REATE
Defined in
DEFAULT_SAMPLE_REATE:188
The default sample rate used when checking for iOS compatibility. See _createAudioContext.
Default: 44100
dynamicsCompressorNode
Defined in
dynamicsCompressorNode:98
A DynamicsCompressorNode, which is used to improve sound quality and prevent audio distortion.
It is connected to context.destination.
Can be accessed by advanced users through createjs.Sound.activePlugin.dynamicsCompressorNode.
gainNode
Defined in
gainNode:109
A GainNode for controlling master volume. It is connected to dynamicsCompressorNode.
Can be accessed by advanced users through createjs.Sound.activePlugin.gainNode.