Skip to content

Commit

Permalink
fix: keep playing state after seek
Browse files Browse the repository at this point in the history
  • Loading branch information
EastSun5566 committed Nov 30, 2022
1 parent e501555 commit 8725196
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions videojs.hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,38 +162,24 @@

// Seeking with the left/right arrow keys
case cRewind: // Seek Backward
wasPlaying = !player.paused();
ePreventDefault();
if (wasPlaying) {
player.pause();
}
seekTime = player.currentTime() - seekStepD(event);
// The flash player tech will allow you to seek into negative
// numbers and break the seekbar, so try to prevent that.
if (seekTime <= 0) {
seekTime = 0;
}
player.currentTime(seekTime);
if (wasPlaying) {
silencePromise(player.play());
}
break;
case cForward: // Seek Forward
wasPlaying = !player.paused();
ePreventDefault();
if (wasPlaying) {
player.pause();
}
seekTime = player.currentTime() + seekStepD(event);
// Fixes the player not sending the end event if you
// try to seek past the duration on the seekbar.
if (seekTime >= duration) {
seekTime = wasPlaying ? duration - .001 : duration;
}
player.currentTime(seekTime);
if (wasPlaying) {
silencePromise(player.play());
}
break;

// Volume control with the up/down arrow keys
Expand Down

0 comments on commit 8725196

Please sign in to comment.