cuechange
event fires when a
TextTrack
has changed the currently displaying cues.
The event is fired at both the
TextTrack
and
在
HTMLTrackElement
in which it's being presented, if any.
| 冒泡 | No |
|---|---|
| 可取消 | No |
| 接口 |
事件
|
| 事件处理程序特性 |
GlobalEventHandlers.oncuechange
|
You can set up a listener for the
cuechange
event on a
TextTrack
使用
addEventListener()
方法:
track.addEventListener('cuechange', function () {
let cues = track.activeCues; // array of current cues
});
Or you can just set the
oncuechange
事件处理程序特性:
track.oncuechange = function () {
let cues = track.activeCues; // array of current cues
}
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
.
let textTrackElem = document.getElementById("texttrack");
textTrackElem.addEventListener("cuechange", (event) => {
let cues = event.target.track.activeCues;
});
In addition, you can use the
oncuechange
event handler:
let textTrackElem = document.getElementById("texttrack");
textTrackElem.oncuechange = (event) => {
let cues = event.target.track.activeCues;
});
| 规范 | 状态 |
|---|---|
|
HTML 实时标准
The definition of 'cuechange' in that specification. |
实时标准 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
cuechange
event
|
Chrome Yes | Edge 12 | Firefox 31 | IE ? | Opera ? | Safari Yes | WebView Android Yes | Chrome Android Yes | Firefox Android 31 | Opera Android No | Safari iOS ? | Samsung Internet Android Yes |
完整支持
不支持
兼容性未知
TextTrack
cuechange