Skip to content

Commit

Permalink
add some simple keyboard controls
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
MrBrax committed Nov 19, 2021
1 parent 5d32565 commit 9bdc8de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/vodplayer.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ Just download chat, but don't input a video at all.

Open the player.html page, load the video file (for better stability) and chat dump (can take a while).

Set settings as wanted, then press Start. Pressing apply while playing will apply modified settings.
Set settings as wanted, then press Start Playback. Pressing apply while playing will apply modified settings.

Right clicking the video and showing controls makes it so you can seek the video.

Press space when player is focused to play, useful if you've toggled fullscreen.
Press space when player is focused to play, useful if you've toggled fullscreen. Arrow keys to seek.

# Recording

Expand Down
25 changes: 18 additions & 7 deletions src/vodplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,15 +1717,26 @@ export default class VODPlayer {
*/

// space to play
/*
this.elements.player.addEventListener('keyup', (ev: KeyboardEvent) => {
if (ev.keyCode == 32) {
ev.preventDefault();
this.play();
return false;
document.body.addEventListener('keyup', (ev: KeyboardEvent) => {
console.log("keyup", ev.key);
if(this.isReady){
if (ev.key == " ") {
console.log("Try to pause video from space");
this.togglePause();
ev.preventDefault();
return false;
}else if(ev.key == "ArrowLeft"){
this.seek(Math.min(Math.max(this.embedPlayer.getCurrentTime() - 10, 0), this.vodLength));
ev.preventDefault();
return false;
}else if(ev.key == "ArrowRight"){
this.seek(Math.min(Math.max(this.embedPlayer.getCurrentTime() + 10, 0), this.vodLength));
ev.preventDefault();
return false;
}
}
});
*/


console.debug('Added hooks');

Expand Down

0 comments on commit 9bdc8de

Please sign in to comment.