I'm using "vanilla" javascript :) I'm trying to replicate youtube's method of pausing video if spacebar is pressed. I'm able to get video to pause if the event is bound to the window but not the video, here is my code.

```
window.addEventListener("keyup", function(evt) {
     if (evt.keyCode === 32) {
        if (video.paused) {
          video.play(); 
        }
        else { 
          video.pause(); 
        } 
    }
 });

```

As in the code above, using **window** works, but if i change **window** to **video** it doesn't work anymore even if I've interacted with the video player. Reason of necessity : if user is watching a video and wants to leave a comment, everytime they press the spacebar the video starts and pauses over and over again. So I need it to only pause or start if user has interacted with the video player and not clicked anywhere else, like youtube. Kind thanks.

Edit: Noticed youtube uses Tabindex (never used it before), to make controls focusable, so that has something to do with it? That's only controls though and not the actual screen.