| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 5 | 5 |
| 6 <script src=../media-file.js></script> | 6 <script src=../media-file.js></script> |
| 7 <script src=../video-test.js></script> | 7 <script src=../video-test.js></script> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 | 10 |
| 11 var seekedCount = 0; | 11 var seekedCount = 0; |
| 12 var testTrack; | 12 var testTrack; |
| 13 | 13 |
| 14 var trackLoaded = false; | 14 var trackLoaded = false; |
| 15 var videoCanPlayThrough = false; | 15 var videoCanPlayThrough = false; |
| 16 | 16 |
| 17 function attemptTests() | 17 function attemptTests() |
| 18 { | 18 { |
| 19 if (!trackLoaded || !videoCanPlayThrough) | 19 if (!trackLoaded || !videoCanPlayThrough) |
| 20 return; | 20 return; |
| 21 | 21 |
| 22 testTrack = document.getElementById("testTrack"); | 22 testTrack = document.getElementById("testTrack"); |
| 23 testExpected("testTrack.track.cues.length", 3); | 23 testExpected("testTrack.track.cues.length", 3); |
| 24 run("video.currentTime = 0.5"); | 24 run("video.currentTime = 0.5"); |
| 25 consoleWrite(""); | 25 consoleWrite(""); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function seeked() | 28 function seeked() |
| 29 { | 29 { |
| 30 ++seekedCount; | 30 ++seekedCount; |
| 31 consoleWrite(""); | 31 consoleWrite(""); |
| 32 | 32 |
| 33 activeCues = testTrack.track.activeCues; | 33 activeCues = testTrack.track.activeCues; |
| 34 | 34 |
| 35 testExpected("video.currentTime", seekedCount * 0.5); | 35 testExpected("video.currentTime", seekedCount * 0.5); |
| 36 testExpected("activeCues.length", seekedCount - 1); | 36 testExpected("activeCues.length", seekedCount - 1); |
| 37 run("video.currentTime = " + (seekedCount + 1) * 0.5); | 37 run("video.currentTime = " + (seekedCount + 1) * 0.5); |
| 38 | 38 |
| 39 consoleWrite(""); | 39 consoleWrite(""); |
| 40 | 40 |
| 41 if (seekedCount == 4) | 41 if (seekedCount == 4) |
| 42 endTest(); | 42 endTest(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 waitForEvent('seeked', seeked); | 45 waitForEvent('seeked', seeked); |
| 46 | 46 |
| 47 waitForEvent('canplaythrough', | 47 waitForEventOnce('canplaythrough', |
| 48 function () | 48 function () |
| 49 { | 49 { |
| 50 videoCanPlayThrough = true; | 50 videoCanPlayThrough = true; |
| 51 attemptTests(); | 51 attemptTests(); |
| 52 } | 52 } |
| 53 ); | 53 ); |
| 54 | 54 |
| 55 function loaded() | 55 function loaded() |
| 56 { | 56 { |
| 57 trackLoaded = true; | 57 trackLoaded = true; |
| 58 attemptTests(); | 58 attemptTests(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 function start() | 61 function start() |
| 62 { | 62 { |
| 63 findMediaElement(); | 63 findMediaElement(); |
| 64 video.src = findMediaFile("video", "../content/test"); | 64 video.src = findMediaFile("video", "../content/test"); |
| 65 } | 65 } |
| 66 </script> | 66 </script> |
| 67 </head> | 67 </head> |
| 68 <body onload="start()"> | 68 <body onload="start()"> |
| 69 <p>Tests TextTrack's activeCues are indexed and updated during video pla
yback.</p> | 69 <p>Tests TextTrack's activeCues are indexed and updated during video pla
yback.</p> |
| 70 <video controls> | 70 <video controls> |
| 71 <track id="testTrack" src="captions-webvtt/cues-overlapping.vtt" kin
d="subtitles" onload="loaded()" default> | 71 <track id="testTrack" src="captions-webvtt/cues-overlapping.vtt" kin
d="subtitles" onload="loaded()" default> |
| 72 </video> | 72 </video> |
| 73 </body> | 73 </body> |
| 74 </html> | 74 </html> |
| OLD | NEW |