1<!DOCTYPE html>
2<html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6 <script src=../media-file.js></script>
7 <script src=../video-test.js></script>
8 <script src=../media-controls.js></script>
9
10 <script>
11
12 var testTrack;
13 var cueDisplayElement;
14 var cueDisplayContainer;
15 var seekedCount = 0;
16
17 var testCaseDescription = [
18 "First cue (empty)",
19 "First cue (one word)",
20 "First cue (two words)",
21 "First cue (three words)",
22 "Second cue (empty)",
23 "Second cue (one word)",
24 "Second cue (two words)",
25 "Second cue (three words)",
26 "Second cue (same as before)",
27 "Second cue (four words)",
28 "Second cue (five words)",
29 "Second cue (same as before)",
30 "Second cue (six words)",
31 "Second cue (seven words)",
32 "Second cue (eight words)",
33 "Third cue (one word)",
34 "Third cue (two words)"
35 ];
36
37 // Each test case is found by incrementing with 0.250 the current time.
38 var testCaseSeekTime = [
39 ];
40
41 var currentTestCase = 0;
42
43 function seeked()
44 {
45 for (var i = 0; i < testTrack.track.activeCues.length; ++i) {
46 cueDisplayElement = textTrackDisplayElement(video, 'display', i);
47
48 consoleWrite("");
49 consoleWrite("* Cue " + i + " *");
50
51 consoleWrite("Current time: " + video.currentTime);
52 consoleWrite("Past: " + cueDisplayElement.childNodes[0].innerHTML);
53 consoleWrite("Future: " + cueDisplayElement.childNodes[1].innerHTML);
54
55 consoleWrite("Complete: " + testTrack.track.activeCues[i].text);
56 }
57
58 runNextTestCase();
59 };
60
61 function runNextTestCase()
62 {
63 if (currentTestCase == testCaseDescription.length) {
64 endTest();
65 return;
66 }
67
68 consoleWrite("");
69 consoleWrite("** " + testCaseDescription[currentTestCase] + " **");
70
71 video.currentTime = testCaseSeekTime[currentTestCase];
72 waitForEvent('seeked', seeked, false, true);
73
74 currentTestCase++;
75 }
76
77 function loaded()
78 {
79 consoleWrite("Test that TextTrack's cues are rendered correctly when they contain inner timestamps.");
80
81 findMediaElement();
82 testTrack = document.querySelector('track');
83 video.src = findMediaFile('video', '../content/test');
84
85 waitForEvent('canplaythrough', function() {
86 cueDisplayContainer = textTrackDisplayElement(video);
87
88 for (i = 0.0; i < 4.500; i += 0.250)
89 testCaseSeekTime.push(i);
90
91 runNextTestCase();
92 });
93 }
94
95 </script>
96 </head>
97 <body onload="loaded()">
98 <video controls>
99 <track src="captions-webvtt/captions-inner-timestamps.vtt" kind="captions" default>
100 </video>
101 </body>
102</html>