API Documentation for: 1.0.0
Show:

PlayPropsConfig Class

Defined in: PlayPropsConfig:39
Module: SoundJS

Available since 0.6.1

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

()

Defined in PlayPropsConfig:39

Available since 0.6.1

Item Index

Methods

Methods

create

(
  • value
)
PlayPropsConfig static

Defined in create:147

Creates a PlayPropsConfig from another PlayPropsConfig or an Object.

Parameters:

Returns:

set

(
  • props
)
PlayPropsConfig

Defined in set:168

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 Object

    A generic object containing properties to copy to the PlayPropsConfig instance.

Returns:

PlayPropsConfig:

Returns the instance the method is called on (useful for chaining calls.)

Properties

delay

Number

Defined in delay:84

The amount of time to delay the start of audio playback, in milliseconds.

Default: null

duration

Number

Defined in duration:134

Used to create an audio sprite (with startTime), the amount of time to play the clip for, in milliseconds.

Default: null

interrupt

String

Defined in interrupt:73

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

Defined in loop:100

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

Defined in offset:92

The offset from the start of the audio to begin playback, in milliseconds.

Default: null

pan

Number

Defined in pan:118

The left-right pan of the sound (if supported), between -1 (left) and 1 (right).

Default: null

startTime

Number

Defined in startTime:126

Used to create an audio sprite (with duration), the initial offset to start playback and loop from, in milliseconds.

Default: null

volume

Number

Defined in volume:109

The volume of the sound, between 0 and 1. Note that the master volume is applied against the individual volume.

Default: null