CordovaAudioSoundInstance extends the base api of AbstractSoundInstance and is used by CordovaAudioPlugin.
CordovaAudioSoundInstancesrc
startTime
duration
playbackResource
Defined in
CordovaAudioSoundInstance:40
src
String
The path to and file name of the sound.
startTime
Number
Audio sprite property used to apply an offset, in milliseconds.
duration
Number
Audio sprite property used to set the time the clip plays for, in milliseconds.
playbackResource
Object
Any resource needed by plugin to support audio playback.
_addLoopingvalue
Inherited from
AbstractSoundInstance:
_addLooping:845
Available since 0.6.0
Internal function called when looping is added during playback.
value
Number
The number of times to loop after play.
_beginPlayingplayProps
Inherited from
AbstractSoundInstance:
_beginPlaying:690
Called by the Sound class when the audio is ready to play (delay has completed). Starts sound playing if the src is loaded, otherwise playback will fail.
playProps
PlayPropsConfig
A PlayPropsConfig object.
If playback succeeded.
_calculateCurrentPositionInherited from
AbstractSoundInstance:
_calculateCurrentPosition:814
Available since 0.6.0
Internal function that calculates the current position of the playhead and sets this._position to that value
_cleanUpInherited from
AbstractSoundInstance:
_cleanUp:666
Clean up the instance. Remove references and clean up any additional properties such as timers.
_getDurationInherited from
AbstractSoundInstance:
_getDuration:570
Please use duration directly as a property
The duration of the sound instance in milliseconds.
_getLoopInherited from
AbstractSoundInstance:
_getLoop:621
Available since 0.6.0
Please use loop directly as a property
_getMutedInherited from
AbstractSoundInstance:
_getMuted:483
Available since 0.6.0
Please use muted directly as a property
If the sound is muted.
_getPanInherited from
AbstractSoundInstance:
_getPan:508
Please use pan directly as a property
The value of the pan, between -1 (left) and 1 (right).
_getPausedInherited from
AbstractSoundInstance:
_getPaused:410
Available since 0.6.0
Please use paused directly as a property.
If the instance is currently paused
_getPlaybackResourcevalue
Inherited from
AbstractSoundInstance:
_getPlaybackResource:609
Available since 0.6.0
Please use playbackResource directly as a property
value
Object
The new playback resource.
playback resource used for playing audio
_getPositionInherited from
AbstractSoundInstance:
_getPosition:518
Please use position directly as a property
The position of the playhead in the sound, in milliseconds.
_getStartTimeInherited from
AbstractSoundInstance:
_getStartTime:546
Please use startTime directly as a property
The startTime of the sound instance in milliseconds.
_getVolumeInherited from
AbstractSoundInstance:
_getVolume:458
Please use volume directly as a property
The current volume of the sound instance.
_handleCleanUpInherited from
AbstractSoundInstance:
_handleCleanUp:886
Available since 0.6.0
Internal function called when AbstractSoundInstance is being cleaned up
_handleLoopInherited from
AbstractSoundInstance:
_handleLoop:896
Available since 0.6.0
Internal function called when AbstractSoundInstance has played to end and is looping
_handleMediaErrorerror
Defined in
_handleMediaError:151
media object has failed and likely will never work
error
Object
_handleSoundCompleteevent
Inherited from
AbstractSoundInstance:
_handleSoundComplete:733
Audio has finished playing. Manually loop it if required.
event
Object
_handleSoundReadyInherited from
AbstractSoundInstance:
_handleSoundReady:755
Handles starting playback when the sound is ready for playing.
_handleStopInherited from
AbstractSoundInstance:
_handleStop:876
Available since 0.6.0
Internal function called when stopping playback
_interruptInherited from
AbstractSoundInstance:
_interrupt:679
The sound has been interrupted.
_pauseInherited from
AbstractSoundInstance:
_pause:856
Available since 0.6.0
Internal function called when pausing playback
_playFailedInherited from
AbstractSoundInstance:
_playFailed:721
Play has failed, which can happen for a variety of reasons. Cleans up instance and dispatches failed event
_removeLoopingvalue
Inherited from
AbstractSoundInstance:
_removeLooping:834
Available since 0.6.0
Internal function called when looping is removed during playback.
value
Number
The number of times to loop after play.
_resumeInherited from
AbstractSoundInstance:
_resume:866
Available since 0.6.0
Internal function called when resuming playback
_sendEventtype
Inherited from
AbstractSoundInstance:
_sendEvent:655
A helper method that dispatches all events for AbstractSoundInstance.
type
String
The event type
_setDurationvalue
Inherited from
AbstractSoundInstance:
_setDuration:580
Available since 0.6.0
Please use duration directly as a property
value
Number
The new duration time in milli seconds.
Returns reference to itself for chaining calls
_setLoopvalue
Inherited from
AbstractSoundInstance:
_setLoop:632
Available since 0.6.0
Please use loop directly as a property
value
Number
The number of times to loop after play.
_setMutedvalue
Inherited from
AbstractSoundInstance:
_setMuted:468
Available since 0.6.0
Please use muted directly as a property
value
Boolean
If the sound should be muted.
A reference to itself, intended for chaining calls.
_setPanvalue
Inherited from
AbstractSoundInstance:
_setPan:494
Please use pan directly as a property
value
Number
The pan value, between -1 (left) and 1 (right).
Returns reference to itself for chaining calls
_setPausedvalue
Inherited from
AbstractSoundInstance:
_setPaused:421
Available since 0.6.0
Please use paused directly as a property
value
Boolean
A reference to itself, intended for chaining calls.
_setPlaybackResourcevalue
Inherited from
AbstractSoundInstance:
_setPlaybackResource:595
Available since 0.6.0
Please use playbackResource directly as a property
value
Object
The new playback resource.
Returns reference to itself for chaining calls
_setPositionvalue
Inherited from
AbstractSoundInstance:
_setPosition:531
Please use position directly as a property
value
Number
The position to place the playhead, in milliseconds.
Returns reference to itself for chaining calls
_setStartTimevalue
Inherited from
AbstractSoundInstance:
_setStartTime:556
Please use startTime directly as a property
value
Number
The new startTime time in milli seconds.
Returns reference to itself for chaining calls
_setVolumevalue
Inherited from
AbstractSoundInstance:
_setVolume:442
Please use volume directly as a property
value
Number
The volume to set, between 0 and 1.
A reference to itself, intended for chaining calls.
_updateDurationInherited from
AbstractSoundInstance
but overwritten in
_updateDuration:794
Available since 0.6.0
Internal function used to update the duration of the audio.
_updatePanInherited from
AbstractSoundInstance:
_updatePan:774
Available since 0.6.0
Internal function used to update the pan
_updatePausePospos
Defined in
_updatePausePos:207
Synchronizes the best guess position with the actual current position.
pos
Number
The current position in seconds
_updatePositionInherited from
AbstractSoundInstance:
_updatePosition:824
Available since 0.6.0
Internal function used to update the position of the playhead.
_updateStartTimeInherited from
AbstractSoundInstance:
_updateStartTime:784
Available since 0.6.1
Internal function used to update the startTime of the audio.
_updateVolumeInherited from
AbstractSoundInstance:
_updateVolume:764
Internal function used to update the volume based on the instance volume, master volume, instance mute value, and master mute value.
addEventListenertype
listener
[useCapture]
Inherited from
EventDispatcher:
addEventListener:140
Adds the specified event listener. Note that adding multiple listeners to the same function will result in multiple callbacks getting fired.
displayObject.addEventListener("click", handleClick);
function handleClick(event) {
// Click happened.
}
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.
[useCapture]
Boolean
optional
For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
applyPlayPropsplayProps
Inherited from
AbstractSoundInstance:
applyPlayProps:386
Available since 0.6.1
Takes an PlayPropsConfig or Object with the same properties and sets them on this instance.
playProps
PlayPropsConfig | Object
A PlayPropsConfig or object containing the same properties.
A reference to itself, intended for chaining calls.
destroyInherited from
AbstractSoundInstance:
destroy:373
Available since 0.6.0
Remove all external references and resources from AbstractSoundInstance. Note this is irreversible and AbstractSoundInstance will no longer work
dispatchEventeventObj
[bubbles]
[cancelable]
Inherited from
EventDispatcher:
dispatchEvent:285
Dispatches the specified event to all listeners.
// Use a string event
this.dispatchEvent("complete");
// Use an Event instance
var event = new createjs.Event("progress");
this.dispatchEvent(event);
eventObj
Object | String | Event
An object with a "type" property, or a string type. While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used, dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can be used to avoid event object instantiation for non-bubbling events that may not have any listeners.
[bubbles]
Boolean
optional
Specifies the bubbles value when a string was passed to eventObj.
[cancelable]
Boolean
optional
Specifies the cancelable value when a string was passed to eventObj.
Returns false if preventDefault() was called on a cancelable event, true otherwise.
getCurrentPositionmediaSuccess
[mediaError=null]
Defined in
getCurrentPosition:135
Maps to Media.getCurrentPosition, which is curiously asynchronus and requires a callback.
mediaSuccess
Method
The callback that is passed the current position in seconds.
[mediaError=null]
Method
optional
(Optional) The callback to execute if an error occurs.
hasEventListenertype
Inherited from
EventDispatcher:
hasEventListener:339
Indicates whether there is at least one listener for the specified event type.
type
String
The string type of the event.
Returns true if there is at least one listener for the specified event.
offtype
listener
[useCapture]
Inherited from
EventDispatcher:
off:249
A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the .on method.
IMPORTANT: To remove a listener added with on, you must pass in the returned wrapper function as the listener. See
on for an example.
ontype
listener
[scope]
[once=false]
[data]
[useCapture=false]
Inherited from
EventDispatcher:
on:173
A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener only run once, associate arbitrary data with the listener, and remove the listener.
This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
The wrapper function is returned for use with removeEventListener (or off).
IMPORTANT: To remove a listener added with on, you must pass in the returned wrapper function as the listener, or use
remove. Likewise, each time you call on a NEW wrapper function is subscribed, so multiple calls
to on with the same params will create multiple listeners.
var listener = myBtn.on("click", handleClick, null, false, {count:3});
function handleClick(evt, data) {
data.count -= 1;
console.log(this == myBtn); // true - scope defaults to the dispatcher
if (data.count == 0) {
alert("clicked 3 times!");
myBtn.off("click", listener);
// alternately: evt.remove();
}
}
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.
[scope]
Object
optional
The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).
[once=false]
Boolean
optional
If true, the listener will remove itself after the first time it is triggered.
[data]
optional
Arbitrary data that will be included as the second parameter when the listener is called.
[useCapture=false]
Boolean
optional
For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.
Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.
playprops
Inherited from
AbstractSoundInstance:
play:320
Play an instance. This method is intended to be called on SoundInstances that already exist (created with the Sound API createInstance or play).
var myInstance = createjs.Sound.createInstance(mySrc);
myInstance.play({interrupt:createjs.Sound.INTERRUPT_ANY, loop:2, pan:0.5});
Note that if this sound is already playing, this call will still set the passed in parameters.
Parameters Deprecated
The parameters for this method are deprecated in favor of a single parameter that is an Object or PlayPropsConfig.
props
Object | PlayPropsConfig
A PlayPropsConfig instance, or an object that contains the parameters to play a sound. See the PlayPropsConfig for more info.
A reference to itself, intended for chaining calls.
removeAllEventListeners[type]
Inherited from
EventDispatcher:
removeAllEventListeners:263
Removes all listeners for the specified type, or all listeners of all types.
// Remove all listeners
displayObject.removeAllEventListeners();
// Remove all click listeners
displayObject.removeAllEventListeners("click");
[type]
String
optional
The string type of the event. If omitted, all listeners for all types will be removed.
removeEventListenertype
listener
[useCapture]
Inherited from
EventDispatcher:
removeEventListener:219
Removes the specified event listener.
Important Note: that you must pass the exact function reference used when the event was added. If a proxy function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or closure will not work.
displayObject.removeEventListener("click", handleClick);
stopInherited from
AbstractSoundInstance:
stop:351
Stop playback of the instance. Stopped sounds will reset their position to 0, and calls to AbstractSoundInstance/resume will fail. To start playback again, call play.
If you don't want to lose your position use yourSoundInstance.paused = true instead. AbstractSoundInstance/paused.
myInstance.stop();
A reference to itself, intended for chaining calls.
toStringInherited from
EventDispatcher:
toString:370
a string representation of the instance.
willTriggertype
Inherited from
EventDispatcher:
willTrigger:350
Indicates whether there is at least one listener for the specified event type on this object or any of its ancestors (parent, parent's parent, etc). A return value of true indicates that if a bubbling event of the specified type is dispatched from this object, it will trigger at least one listener.
This is similar to hasEventListener, but it searches the entire event flow for a listener, not just this object.
type
String
The string type of the event.
Returns true if there is at least one listener for the specified event.
_audioSprite
Defined in
_audioSprite:82
Boolean value that indicates if we are using an audioSprite
_audioSpriteTimeout
Defined in
_audioSpriteTimeout:74
A TimeOut used to trigger the end and possible loop of audio sprites.
_playStartTime
Defined in
_playStartTime:64
Used to approximate the playback position by storing the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC when playing Note that if js clock is out of sync with Media playback, this will become increasingly inaccurate.
delayTimeoutIdInherited from
AbstractSoundInstance:
delayTimeoutId:108
Available since 0.4.0
A Timeout created by Sound when this AbstractSoundInstance is played with a delay. This allows AbstractSoundInstance to remove the delay if stop, pause, or cleanup are called before playback begins.
Default: null
durationInherited from
AbstractSoundInstance:
duration:173
Available since 0.6.0
Sets or gets the length of the audio clip, value is in milliseconds.
Default: 0
loopInherited from
AbstractSoundInstance:
loop:223
Available since 0.6.0
The number of play loops remaining. Negative values will loop infinitely.
Default: 0
mutedInherited from
AbstractSoundInstance:
muted:240
Available since 0.6.0
Mutes or unmutes the current audio instance.
Default: false
panInherited from
AbstractSoundInstance:
pan:142
The pan of the sound, between -1 (left) and 1 (right). Note that pan is not supported by HTML Audio.
Note in WebAudioPlugin this only gives us the "x" value of what is actually 3D audio
Default: 0
pausedInherited from
AbstractSoundInstance:
paused:256
Pauses or resumes the current audio instance.
playbackResourceInherited from
AbstractSoundInstance:
playbackResource:189
Object that holds plugin specific resource need for audio playback. This is set internally by the plugin. For example, WebAudioPlugin will set an array buffer, HTMLAudioPlugin will set a tag, FlashAudioPlugin will set a flash reference.
Default: null
playStateInherited from
AbstractSoundInstance:
playState:100
The play state of the sound. Play states are defined as constants on Sound.
Default: null
playWhenScreenLocked
Defined in
playWhenScreenLocked:56
Sets the playAudioWhenScreenIsLocked property for play calls on iOS devices.
positionInherited from
AbstractSoundInstance:
position:207
Available since 0.6.0
The position of the playhead in milliseconds. This can be set while a sound is playing, paused, or stopped.
Default: 0
startTimeInherited from
AbstractSoundInstance:
startTime:158
Available since 0.6.1
Audio sprite property used to determine the starting offset.
Default: 0
uniqueIdInherited from
AbstractSoundInstance:
uniqueId:92
The unique ID of the instance. This is set by Sound.
Default: -1
volumeInherited from
AbstractSoundInstance:
volume:124
The volume of the sound, between 0 and 1.
The actual output volume of a sound can be calculated using:
myInstance.volume * createjs.Sound._getVolume();
Default: 1
completeInherited from
AbstractSoundInstance:
complete:307
Available since 0.4.0
The event that is fired when playback completes. This means that the sound has finished playing in its entirety, including its loop iterations.
failedInherited from
AbstractSoundInstance:
failed:289
Available since 0.4.0
The event that is fired when playback has failed. This happens when there are too many channels with the same src property already playing (and the interrupt value doesn't cause an interrupt of another instance), or the sound could not be played, perhaps due to a 404 error.
interruptedInherited from
AbstractSoundInstance:
interrupted:280
Available since 0.4.0
The event that is fired when playback is interrupted. This happens when another sound with the same src property is played using an interrupt value that causes this instance to stop playing.
loopInherited from
AbstractSoundInstance:
loop:299
Available since 0.4.0
The event that is fired when a sound has completed playing but has loops remaining.
succeededInherited from
AbstractSoundInstance:
succeeded:272
Available since 0.4.0
The event that is fired when playback has started successfully.