OLD | NEW |
---|---|
1 var captionsButtonElement; | 1 var captionsButtonElement; |
2 var captionsButtonCoordinates; | 2 var captionsButtonCoordinates; |
3 | 3 |
4 // These reflect the values used to fade in/out the media controls. Should | |
5 // mirror the values 'fadeInDuration'/'fadeOutDuration' in MediaControlElements. cpp. | |
philipj_slow
2014/05/26 13:38:47
Add a comment in MediaControlsElements.cpp to poin
fs
2014/05/26 15:02:09
Done.
| |
6 const controlsFadeInDurationMs = 100; | |
7 const controlsFadeOutDurationMs = 300; | |
8 | |
9 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and | |
10 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' | |
11 // in MediaControls.cpp. | |
philipj_slow
2014/05/26 13:38:47
Same.
fs
2014/05/26 15:02:09
Done.
| |
12 const controlsMouseMovementTimeoutMs = 3000; | |
13 | |
4 function mediaControlsElement(first, id) | 14 function mediaControlsElement(first, id) |
5 { | 15 { |
6 for (var element = first; element; element = element.nextSibling) { | 16 for (var element = first; element; element = element.nextSibling) { |
7 // Not every element in the media controls has a shadow pseudo ID, eg. t he | 17 // Not every element in the media controls has a shadow pseudo ID, eg. t he |
8 // text nodes for the time values, so guard against exceptions. | 18 // text nodes for the time values, so guard against exceptions. |
9 try { | 19 try { |
10 if (internals.shadowPseudoId(element) == id) | 20 if (internals.shadowPseudoId(element) == id) |
11 return element; | 21 return element; |
12 } catch (exception) { } | 22 } catch (exception) { } |
13 | 23 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 } | 112 } |
103 } | 113 } |
104 | 114 |
105 function clickCCButton() | 115 function clickCCButton() |
106 { | 116 { |
107 consoleWrite("*** Click the CC button."); | 117 consoleWrite("*** Click the CC button."); |
108 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina tes[1]); | 118 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina tes[1]); |
109 eventSender.mouseDown(); | 119 eventSender.mouseDown(); |
110 eventSender.mouseUp(); | 120 eventSender.mouseUp(); |
111 } | 121 } |
122 | |
123 function runAfterControlsHidden(func, mediaElement) | |
124 { | |
125 if (mediaElement && mediaElement.paused) | |
philipj_slow
2014/05/26 13:38:47
It looks like the second argument is always includ
fs
2014/05/26 15:02:09
Maybe a bit too forward-thinking of me (I.e. allow
| |
126 throw "The media element is not playing"; | |
127 | |
128 // Compute the time it'll take until the controls will be invisible - | |
129 // assuming playback has been started prior to invoking this | |
130 // function. Allow 500ms slack. | |
131 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration Ms + 500; | |
philipj_slow
2014/05/26 13:38:47
Maybe check that hideTimeoutMs >= 1000 * (mediaEle
fs
2014/05/26 15:02:09
Makes sense. Added (w/ added .loop).
| |
132 setTimeout(func, hideTimeoutMs); | |
133 } | |
OLD | NEW |