| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 function clickCCButton() | 113 function clickCCButton() |
| 114 { | 114 { |
| 115 consoleWrite("*** Click the CC button."); | 115 consoleWrite("*** Click the CC button."); |
| 116 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina
tes[1]); | 116 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina
tes[1]); |
| 117 eventSender.mouseDown(); | 117 eventSender.mouseDown(); |
| 118 eventSender.mouseUp(); | 118 eventSender.mouseUp(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 function runAfterControlsHidden(func, mediaElement) | 121 function runAfterHideMediaControlsTimerFired(func, mediaElement) |
| 122 { | 122 { |
| 123 if (mediaElement.paused) | 123 if (mediaElement.paused) |
| 124 throw "The media element is not playing"; | 124 throw "The media element is not playing"; |
| 125 | 125 |
| 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 |