|
41 | 41 | documentHotkeysFocusElementFilter: function () { return false }, |
42 | 42 | enableModifiersForNumbers: true, |
43 | 43 | enableInactiveFocus: true, |
| 44 | + enableSeekPause: true, |
44 | 45 | skipInitialFocus: false, |
45 | 46 | playPauseKey: playPauseKey, |
46 | 47 | rewindKey: rewindKey, |
|
77 | 78 | documentHotkeysFocusElementFilter = options.documentHotkeysFocusElementFilter, |
78 | 79 | enableModifiersForNumbers = options.enableModifiersForNumbers, |
79 | 80 | enableInactiveFocus = options.enableInactiveFocus, |
| 81 | + enableSeekPause = options.enableSeekPause, |
80 | 82 | skipInitialFocus = options.skipInitialFocus; |
81 | 83 |
|
82 | 84 | var videojsVer = videojs.VERSION; |
|
163 | 165 | // Seeking with the left/right arrow keys |
164 | 166 | case cRewind: // Seek Backward |
165 | 167 | ePreventDefault(); |
| 168 | + if (enableSeekPause) { |
| 169 | + wasPlaying = !player.paused(); |
| 170 | + if (wasPlaying) player.pause(); |
| 171 | + } |
166 | 172 | seekTime = player.currentTime() - seekStepD(event); |
167 | 173 | // The flash player tech will allow you to seek into negative |
168 | 174 | // numbers and break the seekbar, so try to prevent that. |
169 | 175 | if (seekTime <= 0) { |
170 | 176 | seekTime = 0; |
171 | 177 | } |
172 | 178 | player.currentTime(seekTime); |
| 179 | + if (enableSeekPause) { |
| 180 | + if (wasPlaying) silencePromise(player.play()); |
| 181 | + } |
173 | 182 | break; |
174 | 183 | case cForward: // Seek Forward |
175 | 184 | ePreventDefault(); |
| 185 | + if (enableSeekPause) { |
| 186 | + wasPlaying = !player.paused(); |
| 187 | + if (wasPlaying) player.pause(); |
| 188 | + } |
176 | 189 | seekTime = player.currentTime() + seekStepD(event); |
177 | 190 | // Fixes the player not sending the end event if you |
178 | 191 | // try to seek past the duration on the seekbar. |
179 | 192 | if (seekTime >= duration) { |
180 | 193 | seekTime = wasPlaying ? duration - .001 : duration; |
181 | 194 | } |
182 | 195 | player.currentTime(seekTime); |
| 196 | + if (enableSeekPause) { |
| 197 | + if (wasPlaying) silencePromise(player.play()); |
| 198 | + } |
183 | 199 | break; |
184 | 200 |
|
185 | 201 | // Volume control with the up/down arrow keys |
|
0 commit comments