Reference addCue()

addCue()

Schedule events to trigger every time a MediaElement (audio/video) reaches a playback cue point.

Accepts a callback function, a time (in seconds) at which to trigger the callback, and an optional parameter for the callback.

Time will be passed as the first parameter to the callback function, and param will be the second parameter.

Examples

Syntax

addCue(time, callback, [value])

Parameters

time
Number:

Time in seconds, relative to this media element's playback. For example, to trigger an event every time playback reaches two seconds, pass in the number 2. This will be passed as the first parameter to the callback function.

callback
Function:

Name of a function that will be called at the given time. The callback will receive time and (optionally) param as its two parameters.

value
Object:

An object to be passed as the second parameter to the callback function.

Returns

Number: id ID of this cue, useful for removeCue(id)
Notice any errors or typos? Please let us know. Please feel free to edit lib/addons/p5.sound.js and open a pull request!

Related References