Last active
September 26, 2018 06:58
-
-
Save suren-atoyan/b6d6d2508225596fb4714317cccda483 to your computer and use it in GitHub Desktop.
Snippet for Chrome - When you are using Google Chrome for playing video or audio, but Right and Left arrow buttons don't work properly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;((d, s) => { | |
const player = s | |
? d.querySelector(s) | |
: d.querySelectorAll('audio')[0] | |
|| d.querySelectorAll('video')[0]; | |
d.addEventListener('keydown', ({ key }) => key === 'ArrowRight' | |
? player.currentTime += 5 | |
: key === 'ArrowLeft' && (player.currentTime -= 5) | |
); | |
})(document/*, selector <- custom selector*/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment