-
Notifications
You must be signed in to change notification settings - Fork 12
Sound
Create and play new mp3
NOTE: Unless the sound being referenced by ID or locator has already been preloaded, all new Sound({...})
expressions, including preloads, must always immediately follow a user input action -- like in your Init Script, in a click listener function, after a paused say, choice, etc. You will have issues if you do not strictly follow this!
Example:
// Create and play new sound
var mySound = new Sound({
locator: "file:12bpm.mp3",
loops: 0, // Play until I stop it
})
// Stop sound in 5 seconds.
setTimeout(function() {mySound.stop()}, 5000)
Optional String. Id to use with Sound.get(id)
Required String. Valid EOS locator for sound file
Required Number. Number of times to play the sound before stopping. 0 = forver.
Optional Number. Volume level between 0 and 1
Optional Function or Boolean.
If set true
, will begin preload of audio. Subsequent navigation (pages.goto(...)
) will be paused until preload completes.
If set to a function, function will be called when preload completes, and subsequent navigation (pages.goto(...)
) will be paused until preload completes.
Return sound instance for given id
Remove sound.
Stop given sound
Pause given sound
Play given sound
Execute a function at a given time in the sound.
- seconds: Required. Floating point value of number of second into the audio playback the function should execute.
- function: Required. The function you wish to execute the given time.
Remove all doAt functions that have been set via setDoAt.
[TODO: Add other methods]