Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that disables it given conditions:
- os == "android" : https://bugzilla.mozilla.org/show_bug.cgi?id=1536762
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/media-elements/track/track-element/track-webvtt-two-cue-layout-after-first-end.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<title>WebVTT two-cue layout after the first cue has ended</title>
<link rel="match" href="track-webvtt-two-cue-layout-after-first-end-ref.html">
<script src="/common/reftest-wait.js"></script>
<video style="border:1px solid gray">
<source src="/media/white.webm" type="video/webm">
<source src="/media/white.mp4" type="video/mp4">
</video>
<script>
// Add two cues, where the first cue ends before the second.
var video = document.querySelector("video");
var track = video.addTextTrack("captions");
let cue1 = new VTTCue(-1, 1, "cue 1");
track.addCue(cue1);
// As video's duration is 10s, it ensures that this cue would always be displayed.
track.addCue(new VTTCue(0, 10, "cue 2"));
track.mode = "showing";
video.play();
cue1.onexit = () => {
cue1.onexit = null;
video.pause();
takeScreenshot();
};
</script>
</html>