| 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; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (childElement) | 24 if (childElement) |
| 25 return childElement; | 25 return childElement; |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 return null; | 29 return null; |
| 30 } | 30 } |
| 31 | 31 |
| 32 function mediaControlsButton(element, id) | 32 function mediaControlsButton(element, id) |
| 33 { | 33 { |
| 34 var controlID = "-webkit-media-controls-" + id; | 34 var controlID = "-internal-media-controls-" + id; |
| 35 var button = mediaControlsElement(internals.shadowRoot(element).firstChild,
controlID); | 35 var button = mediaControlsElement(internals.shadowRoot(element).firstChild,
controlID); |
| 36 if (!button) | 36 if (!button) |
| 37 throw "Failed to find media control element ID '" + id + "'"; | 37 throw "Failed to find media control element ID '" + id + "'"; |
| 38 return button; | 38 return button; |
| 39 } | 39 } |
| 40 | 40 |
| 41 function mediaControlsButtonCoordinates(element, id) | 41 function mediaControlsButtonCoordinates(element, id) |
| 42 { | 42 { |
| 43 var button = mediaControlsButton(element, id); | 43 var button = mediaControlsButton(element, id); |
| 44 var buttonBoundingRect = button.getBoundingClientRect(); | 44 var buttonBoundingRect = button.getBoundingClientRect(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Compute the time it'll take until the controls will be invisible - | 126 // Compute the time it'll take until the controls will be invisible - |
| 127 // assuming playback has been started prior to invoking this | 127 // assuming playback has been started prior to invoking this |
| 128 // function. Allow 500ms slack. | 128 // function. Allow 500ms slack. |
| 129 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration
Ms + 500; | 129 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration
Ms + 500; |
| 130 | 130 |
| 131 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m
ediaElement.currentTime)) | 131 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m
ediaElement.currentTime)) |
| 132 throw "The media will end before the controls have been hidden"; | 132 throw "The media will end before the controls have been hidden"; |
| 133 | 133 |
| 134 setTimeout(func, hideTimeoutMs); | 134 setTimeout(func, hideTimeoutMs); |
| 135 } | 135 } |
| OLD | NEW |