OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src=../media-file.js></script> | |
3 <script src=../video-test.js></script> | |
4 <script src=../media-controls.js></script> | |
5 <script> | |
6 | |
7 function applyUserOverrideSettings() { | |
8 if (window.internals) { | |
9 internals.settings.setTextTrackTextColor("purple"); | |
10 internals.settings.setTextTrackTextSize("14px"); | |
11 } | |
12 } | |
13 | |
14 function verifyDefaultSettings() { | |
15 consoleWrite(""); | |
16 cue = textTrackDisplayElement(video, 'cue'); | |
17 // These are the expected default cue settings per spec | |
18 // http://dev.w3.org/html5/webvtt/#applying-css-properties-to-webvtt-nod e-objects | |
19 testExpected("getComputedStyle(cue).color", "rgb(255, 255, 255)"); | |
20 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8 )"); | |
21 testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); | |
22 // Apply user settings for color and font-size and verify that the other internal settings are retained. | |
23 applyUserOverrideSettings(); | |
24 run("video.currentTime = 0.3"); | |
25 checkExpected(); | |
26 } | |
27 | |
28 function checkExpected() { | |
29 consoleWrite(""); | |
30 cue = textTrackDisplayElement(video, 'cue'); | |
31 testExpected("getComputedStyle(cue).color", "rgb(128, 0, 128)"); | |
32 testExpected("getComputedStyle(cue).fontSize", "14px"); | |
33 // When there is no user setting specified for background-color and font -family, the internal settings are applied. | |
34 testExpected("getComputedStyle(cue).backgroundColor", "rgba(0, 0, 0, 0.8 )"); | |
35 testExpected("getComputedStyle(cue).fontFamily", "sans-serif"); | |
36 endTest(); | |
37 } | |
38 | |
39 window.onload = function() { | |
40 consoleWrite("Test that WebVTT objects are being styled correctly based on user settings that should override app default settings."); | |
41 findMediaElement(); | |
42 video.src = findMediaFile('video', '../content/test'); | |
43 waitForEvent('seeked', verifyDefaultSettings); | |
44 waitForEvent('canplaythrough', function() { video.currentTime = 0.1; }); | |
philipj_slow
2015/03/26 05:24:36
To simplify, you can set currentTime immediate aft
srivats
2015/03/26 06:37:42
Done.
| |
45 } | |
46 | |
47 </script> | |
48 <video> | |
49 <track src="captions-webvtt/styling.vtt" kind="captions" default> | |
50 </video> | |
OLD | NEW |