AbstractPlugin Class
A default plugin class used as a base for all other plugins.
Constructor
AbstractPlugin
()
Methods
_handlePreloadComplete
-
event
Handles internal preload completion.
Parameters:
-
event
Object
_updateVolume
()
protected
Set the gain value for master audio. Should not be called externally.
create
-
src
-
startTime
-
duration
Create a sound instance. If the sound has not been preloaded, it is internally preloaded here.
Parameters:
Returns:
A sound instance for playback and control.
getVolume
()
Number
Get the master volume of the plugin, which affects all SoundInstances.
Returns:
The volume level, between 0 and 1.
isPreloadComplete
-
src
Checks if preloading has finished for a specific source.
Parameters:
-
src
StringThe sound URI to load.
Returns:
isPreloadStarted
-
src
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.
Parameters:
-
src
StringThe sound URI to check.
Returns:
isSupported
()
Boolean
static
Determine if the plugin can be used in the current browser/OS.
Returns:
If the plugin can be initialized.
preload
-
loader
Internally preload a sound.
Parameters:
-
loader
LoaderThe sound URI to load.
register
-
loadItem
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.
Parameters:
-
loadItem
StringAn Object containing the source of the audio Note that not every plugin will manage this value.
Returns:
A result object, containing a "tag" for preloading purposes.
removeAllSounds
-
src
Remove all sounds added using WebAudioPlugin/register. Note this does not cancel a preload.
Parameters:
-
src
StringThe sound URI to unload.
removeSound
-
src
Remove a sound added using WebAudioPlugin/register. Note this does not cancel a preload.
Parameters:
-
src
StringThe sound URI to unload.
Properties
_audioSources
Object
protected
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
Object
protected
static
The capabilities of the plugin. method and is used internally.
Default: null
_capabilities
Object
private
static
The capabilities of the plugin. This is generated via the _generateCapabilities method and is used internally.
Default: null