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.
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.
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("cuechange", (event) => {}); oncuechange = (event) => {};
A generic Event
with no added properties.
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("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; });
Alternatively, you can use the oncuechange
event handler:
js
let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechange = (event) => { let cues = event.target.track.activeCues; };
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
cuechange_event |
3223Theoncuechange event handler property is not supported. |
14 | 68 | No | 1915Theoncuechange event handler property is not supported. |
106Theoncuechange event handler property is not supported. |
≤37Theoncuechange event handler property is not supported. |
3225Theoncuechange event handler property is not supported. |
68 | 1914Theoncuechange event handler property is not supported. |
106Theoncuechange event handler property is not supported. |
2.01.5Theoncuechange event handler property is not supported. |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement/cuechange_event