HTMLTrackElement: 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 2019.

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

The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element.

If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement.

js
let textTrackElem = document.getElementById("text-track");

textTrackElem.addEventListener("cuechange", (event) => {
  let cues = event.target.track.activeCues;
});

Alternatively, you can use the oncuechange event handler:

js
let textTrackElem = document.getElementById("text-track");

textTrackElem.oncuechange = (event) => {
  let cues = event.target.track.activeCues;
};

Specifications

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
cuechange event
Chrome – Partial support
Chrome 23 – 31 (Release date: 2012-11-06)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Chrome – Full support
Chrome 32 (Release date: 2014-01-14)
footnote Full support
Edge – Full support
Edge 14 (Release date: 2016-08-02)
footnote Full support
Firefox – Full support
Firefox 68 (Release date: 2019-07-09)
footnote Full support
Opera – No support
Opera 12 – 12.1 (Release date: 2012-06-14)
unknown Support unknown
Opera – Partial support
Opera 15 – 18 (Release date: 2013-07-02)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Opera – Full support
Opera 19 (Release date: 2014-01-28)
footnote Full support
Safari – Partial support
Safari 6 – 9.1 (Release date: 2012-07-25)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Partial support
Chrome Android 25 – 31 (Release date: 2013-02-27)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Chrome Android – Full support
Chrome Android 32 (Release date: 2014-01-15)
footnote Full support
Firefox for Android – Full support
Firefox for Android 68 (Release date: 2019-07-09)
footnote Full support
Opera Android – No support
Opera Android 12 – 12.1 (Release date: 2012-02-25)
unknown Support unknown
Opera Android – Partial support
Opera Android 14 – 18 (Release date: 2013-05-21)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Opera Android – Full support
Opera Android 19 (Release date: 2014-01-28)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 6 – 9.3 (Release date: 2012-09-10)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Partial support
Samsung Internet 1.5 – 1.6 (Release date: 2013-09-25)
footnote Partial support
footnote The oncuechange event handler property is not supported.
Samsung Internet – Full support
Samsung Internet 2 (Release date: 2014-10-17)
footnote Full support
WebView Android – Partial support
WebView Android 4.4 – 4.4 (Release date: 2013-12-09)
footnote Partial support
footnote The oncuechange event handler property is not supported.
WebView Android – Full support
WebView Android 4.4.3 (Release date: 2014-06-02)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 6 – 9.3 (Release date: 2012-09-10)
footnote Partial support
footnote The oncuechange event handler property is not supported.
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support

Legend

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

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also