diff options
author | cky <576779975@qq.com> | 2018-06-06 19:27:07 +0800 |
---|---|---|
committer | cky <576779975@qq.com> | 2018-06-06 19:27:07 +0800 |
commit | 84424f7f67461a3da7f3a1ba1ffea6505dddc4dc (patch) | |
tree | 093451d4609fb7e3cdbe38255fa59945336325cc | |
parent | c95d9923f7996ca7331e6f1f7f232066ec1d002e (diff) | |
download | plyr-84424f7f67461a3da7f3a1ba1ffea6505dddc4dc.tar.lz plyr-84424f7f67461a3da7f3a1ba1ffea6505dddc4dc.tar.xz plyr-84424f7f67461a3da7f3a1ba1ffea6505dddc4dc.zip |
fix: when the seek input is focused and the video is playing, the space key can't make the video pause, because after 'keyup', it always make the video play
-rw-r--r-- | src/js/listeners.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js index 45d6097c..81f5271c 100644 --- a/src/js/listeners.js +++ b/src/js/listeners.js @@ -563,6 +563,12 @@ class Listeners { on(this.player.elements.inputs.seek, 'mousedown mouseup keydown keyup touchstart touchend', event => { const seek = event.currentTarget; + const code = event.keyCode ? event.keyCode : event.which; + const eventType = event.type; + + if ((eventType === 'keydown' || eventType === 'keyup') && (code !== 39 && code !== 37)) { + return; + } // Was playing before? const play = seek.hasAttribute('play-on-seeked'); |