Play sounds using HTML <audio> tags in the browser. This plugin is the second priority plugin installed by default, after the WebAudioPlugin. For older browsers that do not support html audio, include and install the FlashAudioPlugin.
IE html limitations
Safari limitations
iOS 6 limitations
Android Native Browser limitations
See Sound for general notes on known issues.
_generateCapabilities
Defined in
_generateCapabilities:193
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
_updateVolumeInherited from
AbstractPlugin:
_updateVolume:312
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:181
Determine if the plugin can be used in the current browser/OS. Note that HTML audio is available in most modern browsers, but is disabled in iOS because of its limitations.
If the plugin can be initialized.
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.
_AUDIO_ENDED
Defined in
_AUDIO_ENDED:127
Event constant for the "ended" event for cleaner code.
Default: ended
_AUDIO_READY
Defined in
_AUDIO_READY:117
Event constant for the "canPlayThrough" event for cleaner code.
Default: canplaythrough
_AUDIO_SEEKED
Defined in
_AUDIO_SEEKED:137
Event constant for the "seeked" event for cleaner code. We utilize this event for maintaining loop events.
Default: seeked
_AUDIO_STALLED
Defined in
_AUDIO_STALLED:147
Event constant for the "stalled" event for cleaner code.
Default: stalled
_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:168
The capabilities of the plugin. This is generated via the _generateCapabilities method. Please see the Sound capabilities method for an overview of all of the available properties.
_TIME_UPDATE
Defined in
_TIME_UPDATE:157
Event constant for the "timeupdate" event for cleaner code. Utilized for looping audio sprites. This event callsback ever 15 to 250ms and can be dropped by the browser for performance.
Default: timeupdate
_volumeInherited from
AbstractPlugin:
_volume:83
The internal master volume value of the plugin.
Default: 1
MAX_INSTANCES
Defined in
MAX_INSTANCES:106
The maximum number of instances that can be loaded or played. This is a browser limitation, primarily limited to IE9. The actual number varies from browser to browser (and is largely hardware dependant), but this is a safe estimate. Audio sprites work around this limitation.
Default: 30