OLD | NEW |
1 var captionsButtonElement; | 1 var captionsButtonElement; |
2 var captionsButtonCoordinates; | 2 var captionsButtonCoordinates; |
3 | 3 |
4 // As specified in mediaControls.css, this is how long it takes to fade out cont
rols | 4 // As specified in mediaControls.css, this is how long it takes to fade out cont
rols |
5 const controlsFadeOutDurationMs = 300; | 5 const controlsFadeOutDurationMs = 300; |
6 | 6 |
7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and | 7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and |
8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' | 8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' |
9 // in MediaControls.cpp. | 9 // in MediaControls.cpp. |
10 const controlsMouseMovementTimeoutMs = 3000; | 10 const controlsMouseMovementTimeoutMs = 3000; |
11 | 11 |
12 function castButton(videoElement) { | 12 function castButton(videoElement) { |
13 var controlID = '-internal-media-controls-cast-button'; | 13 var controlID = '-internal-media-controls-cast-button'; |
14 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); | 14 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); |
15 if (!button) | 15 if (!button) |
16 throw 'Failed to find cast button'; | 16 throw 'Failed to find cast button'; |
17 return button; | 17 return button; |
18 } | 18 } |
19 | 19 |
| 20 function downloadButton(videoElement) { |
| 21 var controlID = '-internal-media-controls-download-button'; |
| 22 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); |
| 23 if (!button) |
| 24 throw 'Failed to find download button'; |
| 25 return button; |
| 26 } |
| 27 |
| 28 function fullscreenButton(videoElement) { |
| 29 var controlID = '-webkit-media-controls-fullscreen-button'; |
| 30 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); |
| 31 if (!button) |
| 32 throw 'Failed to find fullscreen button'; |
| 33 return button; |
| 34 } |
| 35 |
20 function overlayCastButton(videoElement) | 36 function overlayCastButton(videoElement) |
21 { | 37 { |
22 var controlID = '-internal-media-controls-overlay-cast-button'; | 38 var controlID = '-internal-media-controls-overlay-cast-button'; |
23 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); | 39 var button = mediaControlsElement(window.internals.shadowRoot(videoElement).
firstChild, controlID); |
24 if (!button) | 40 if (!button) |
25 throw 'Failed to find cast button'; | 41 throw 'Failed to find cast button'; |
26 return button; | 42 return button; |
27 } | 43 } |
28 | 44 |
29 function mediaControlsElement(first, id) | 45 function mediaControlsElement(first, id) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 function hasFullscreenButton(element) | 221 function hasFullscreenButton(element) |
206 { | 222 { |
207 var size = mediaControlsButtonDimensions(element, "fullscreen-button"); | 223 var size = mediaControlsButtonDimensions(element, "fullscreen-button"); |
208 return size[0] > 0 && size[1] > 0; | 224 return size[0] > 0 && size[1] > 0; |
209 } | 225 } |
210 | 226 |
211 function isControlsPanelVisible(element) | 227 function isControlsPanelVisible(element) |
212 { | 228 { |
213 return getComputedStyle(mediaControlsButton(element, "panel")).opacity == "1
"; | 229 return getComputedStyle(mediaControlsButton(element, "panel")).opacity == "1
"; |
214 } | 230 } |
OLD | NEW |