OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../media-file.js"></script> | 4 <script src="../media-file.js"></script> |
5 <script src="../video-test.js"></script> | 5 <script src="../video-test.js"></script> |
6 <script> | 6 <script> |
7 function onLoad() | 7 function onLoad() |
8 { | 8 { |
9 if (window.testRunner) | 9 if (window.testRunner) |
10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
11 | 11 |
12 var cueDuration = 0.1; | 12 var cueDuration = 0.1; |
13 var video = document.querySelector("#vid"); | 13 var video = document.querySelector("#vid"); |
14 var track = video.addTextTrack("subtitles"); | 14 var track = video.addTextTrack("subtitles"); |
15 track.mode = "disabled"; | 15 track.mode = "disabled"; |
16 | 16 |
17 for (var i = 0; i < 10; ++i) { | 17 for (var i = 0; i < 10; ++i) { |
18 var start = i * cueDuration; | 18 var start = i * cueDuration; |
19 var end = start + cueDuration; | 19 var end = start + cueDuration; |
20 track.addCue(new TextTrackCue(start, end, "Test Cue " + i)); | 20 track.addCue(new VTTCue(start, end, "Test Cue " + i)); |
21 } | 21 } |
22 | 22 |
23 consoleWrite("Waiting for 2 cue durations to elapse."); | 23 consoleWrite("Waiting for 2 cue durations to elapse."); |
24 | 24 |
25 video.addEventListener('timeupdate', function (e) | 25 video.addEventListener('timeupdate', function (e) |
26 { | 26 { |
27 if (e.target.currentTime < 2 * cueDuration) | 27 if (e.target.currentTime < 2 * cueDuration) |
28 return; | 28 return; |
29 | 29 |
30 // End test after at least 2 cueDurations to make sure the
test | 30 // End test after at least 2 cueDurations to make sure the
test |
31 // doesn't crash during the period the first 2 cues would
have been | 31 // doesn't crash during the period the first 2 cues would
have been |
32 // rendered if the track was not disabled. | 32 // rendered if the track was not disabled. |
33 consoleWrite("2 cue durations have elapsed."); | 33 consoleWrite("2 cue durations have elapsed."); |
34 endTest(); | 34 endTest(); |
35 }); | 35 }); |
36 video.play(); | 36 video.play(); |
37 } | 37 } |
38 </script> | 38 </script> |
39 </head> | 39 </head> |
40 <body onload="onLoad()"> | 40 <body onload="onLoad()"> |
41 <p>Test adding cues to a disabled text track. </p> | 41 <p>Test adding cues to a disabled text track. </p> |
42 <video id="vid" src="../content/test.ogv" controls></video> | 42 <video id="vid" src="../content/test.ogv" controls></video> |
43 </body> | 43 </body> |
44 </html> | 44 </html> |
OLD | NEW |