PlayPropsConfig Class
A class to store the optional play properties passed in play and play calls.
Optional Play Properties Include:
- interrupt - How to interrupt any currently playing instances of audio with the same source,
if the maximum number of instances of the sound are already playing. Values are defined as
INTERRUPT_TYPE
constants on the Sound class, with the default defined by defaultInterruptBehavior. - delay - The amount of time to delay the start of audio playback, in milliseconds.
- offset - The offset from the start of the audio to begin playback, in milliseconds.
- loop - How many times the audio loops when it reaches the end of playback. The default is 0 (no loops), and -1 can be used for infinite playback.
- volume - The volume of the sound, between 0 and 1. Note that the master volume is applied against the individual volume.
- pan - The left-right pan of the sound (if supported), between -1 (left) and 1 (right).
- startTime - To create an audio sprite (with duration), the initial offset to start playback and loop from, in milliseconds.
- duration - To create an audio sprite (with startTime), the amount of time to play the clip for, in milliseconds.
Example
var props = new createjs.PlayPropsConfig().set({interrupt: createjs.Sound.INTERRUPT_ANY, loop: -1, volume: 0.5})
createjs.Sound.play("mySound", props);
// OR
mySoundInstance.play(props);
Constructor
PlayPropsConfig
()
Item Index
Methods
create
-
value
Creates a PlayPropsConfig from another PlayPropsConfig or an Object.
Parameters:
-
value
PlayPropsConfig | ObjectThe play properties
Returns:
set
-
props
Provides a chainable shortcut method for setting a number of properties on the instance.
Example
var PlayPropsConfig = new createjs.PlayPropsConfig().set({loop:-1, volume:0.7});
Parameters:
-
props
ObjectA generic object containing properties to copy to the PlayPropsConfig instance.
Returns:
Returns the instance the method is called on (useful for chaining calls.)
Properties
delay
Number
The amount of time to delay the start of audio playback, in milliseconds.
Default: null
duration
Number
Used to create an audio sprite (with startTime), the amount of time to play the clip for, in milliseconds.
Default: null
interrupt
String
How to interrupt any currently playing instances of audio with the same source,
if the maximum number of instances of the sound are already playing. Values are defined as
INTERRUPT_TYPE
constants on the Sound class, with the default defined by
defaultInterruptBehavior.
Default: null
loop
Number
How many times the audio loops when it reaches the end of playback. The default is 0 (no loops), and -1 can be used for infinite playback.
Default: null
offset
Number
The offset from the start of the audio to begin playback, in milliseconds.
Default: null
pan
Number
The left-right pan of the sound (if supported), between -1 (left) and 1 (right).
Default: null
startTime
Number
Used to create an audio sprite (with duration), the initial offset to start playback and loop from, in milliseconds.
Default: null
volume
Number
The volume of the sound, between 0 and 1. Note that the master volume is applied against the individual volume.
Default: null