A cue utility for HTML5 video
npm install --save video-cues
import { CueList } from 'video-cues';
let video = document.getElementById('video');
let cueList = CueList.create(video);
cueList.add(['25%', '50%', '75%'], (cue) => {
// cue.offset
// track progress or start midroll ad
});
Creates a new cue list.
Param video
HTMLVideoElement The video element to trigger cue points.
Returns Object
Adds cue points to the list.
Param offsets
Array Values representing the progress required to trigger a cue point. Either a number of seconds, or a percentage as a string.
Param handler
Function The function to call when a cue point is triggered.
Removes cue points with the given offsets. All cue points are removed if no argument is passed.
Param offsets
Array A list of offsets as a number of seconds, or a percentage as a string.
Gets the offsets of all cue points.
Returns Array
Disables all cue points.
Enables all cue points.
Resets the triggered state of all cue points.
Clears the the cue list and removes all event listeners.
MIT