TextTrack: cuechange event

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

The cuechange event fires when a TextTrack has changed the currently displaying cues. The event is fired on both the TextTrack and the HTMLTrackElement in which it's being presented, if any.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js
addEventListener("cuechange", (event) => {});

oncuechange = (event) => {};

Event type

A generic Event with no added properties.

Examples

You can set up a listener for the cuechange event on a TextTrack using the addEventListener() method:

js
track.addEventListener("cuechange", () => {
  const cues = track.activeCues; // array of current cues
  // …
});

Or you can set the oncuechange event handler property:

js
track.oncuechange = (event) => {
  let cues = track.activeCues; // array of current cues
};

Specifications

Specification
HTML
# event-media-cuechange
HTML
# handler-texttrack-oncuechange

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
cuechange event

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also