参考 addCue()

addCue()

Schedules a function to call when the audio/video reaches a specific time during its playback.

The first parameter, time, is the time, in seconds, when the function should run. This value is passed to callback as its first argument.

The second parameter, callback, is the function to call at the specified cue time.

The third parameter, value, is optional and can be any type of value. value is passed to callback.

Calling media.addCue() returns an ID as a string. This is useful for removing the cue later.

示例

语法

addCue(time, callback, [value])

参数

time
Number:

cue time to run the callback function.

callback
Function:

function to call at the cue time.

value
Object:

object to pass as the argument to callback.

Returns

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

相关参考