Last active
August 3, 2019 18:52
-
-
Save a-eid/5d4d9dc858d14b381bce349ea934aa9f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const video = () => document.querySelector("video") | |
const codes = { | |
space: 32, | |
j: 74, | |
k: 75, | |
l: 76, | |
} | |
document.addEventListener("keydown", e => { | |
if ( e.keyCode == codes.k ) { | |
toggle() | |
} | |
if (e.keyCode == codes.l) forward() | |
if (e.keyCode == codes.j) backword() | |
}) | |
function forward() { | |
video().currentTime = video().currentTime + 10 | |
} | |
function backword() { | |
video().currentTime = video().currentTime - 10 | |
} | |
function toggle() { | |
video().paused ? video().play() : video().pause() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment