summaryrefslogtreecommitdiffstats
path: root/dom/media/webvtt/test/reftest/vtt_overlapping_time.html
blob: f973b398d565dc0f80808e361fa6995dccaf0546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
</head>
<body>
<video id="v1" src="black.mp4" autoplay width="320" height="180">
  <track label="English" src="cues_time_overlapping.webvtt" default>
</video>
<script type="text/javascript">
/**
 * This test is to ensure that when cues with overlapping times, the one with
 * earlier end timestamp should disappear when the media time reaches its
 * end time. This vtt file contains two cues, the first cue is [0,1], the second
 * cue is [0,4], so after video is playing over 1s, only cue2 should be displayed.
 */
async function testTimeOverlappingCues() {
  const video = document.getElementById("v1");
  video.ontimeupdate = () => {
    if (video.currentTime > 1.0) {
      document.documentElement.removeAttribute('class');
      video.ontimeupdate = null;
    }
  }
};

window.addEventListener("MozReftestInvalidate",
                        testTimeOverlappingCues);
</script>
</body>
</html>