Cuepoints are a powerful way of executing code at predefined times
during playback. This mechanism is especially useful for long videos
where you might want to have special events triggered during the
period in which the video is playing. For example, in teaching videos
you might want to enrich your clip with help texts or other
interactive material. Or, in a more commercial setting, you might want
to show targeted advertisements at certain points in the video.
Here is a basic cuepoint configuration for a clip:
If the time is given as a negative integer, then it is calculated from
the end of the video. So -1000 means the last second of the video, -2000
means two seconds from the end of the video, and so on.
Cuepoints are set up in the onCuepoint event listener. It differs from all other
event listeners inasmuch as it customizes a series of events and is configured
as an array with the event handler as second item.
How To Configure
An array of 2 members:
an array of customizable cuepoints containing:
the time when the event is fired - either an integer or a property
labeled time (mandatory)
custom properties for the specific cuepoint (optional)
the cuepoint event handler function which takes 2 arguments:
the current clip object
the current cuepoint
Each cuepoint can optionally have custom properties that are supplied
to the event handler.
Sometimes you just want to define a single cuepoint and not a long
list. In that case, you can omit the array and just supply one number.
You can also add cuepoints by scripting. Here is an example.
Note how the 2 members of the onCuepoint configuration array turn into 2 arguments
when onCuepoint is called as an API function.
This example uses two cuepoints that both print messages using the