|
|
@ -228,11 +228,24 @@ function set_time_percent(percent) {
|
|
|
|
player.currentTime(newTime);
|
|
|
|
player.currentTime(newTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function play() {
|
|
|
|
|
|
|
|
player.play();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pause() {
|
|
|
|
|
|
|
|
player.pause();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function stop() {
|
|
|
|
|
|
|
|
player.pause();
|
|
|
|
|
|
|
|
player.currentTime(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function toggle_play() {
|
|
|
|
function toggle_play() {
|
|
|
|
if (player.paused()) {
|
|
|
|
if (player.paused()) {
|
|
|
|
player.play();
|
|
|
|
play();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
player.pause();
|
|
|
|
pause();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -338,9 +351,22 @@ window.addEventListener('keydown', e => {
|
|
|
|
switch (decoratedKey) {
|
|
|
|
switch (decoratedKey) {
|
|
|
|
case ' ':
|
|
|
|
case ' ':
|
|
|
|
case 'k':
|
|
|
|
case 'k':
|
|
|
|
|
|
|
|
case 'MediaPlayPause':
|
|
|
|
action = toggle_play;
|
|
|
|
action = toggle_play;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'MediaPlay':
|
|
|
|
|
|
|
|
action = play;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'MediaPause':
|
|
|
|
|
|
|
|
action = pause;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'MediaStop':
|
|
|
|
|
|
|
|
action = stop;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'ArrowUp':
|
|
|
|
case 'ArrowUp':
|
|
|
|
if (isPlayerFocused) {
|
|
|
|
if (isPlayerFocused) {
|
|
|
|
action = increase_volume.bind(this, 0.1);
|
|
|
|
action = increase_volume.bind(this, 0.1);
|
|
|
@ -357,9 +383,11 @@ window.addEventListener('keydown', e => {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'ArrowRight':
|
|
|
|
case 'ArrowRight':
|
|
|
|
|
|
|
|
case 'MediaFastForward':
|
|
|
|
action = skip_seconds.bind(this, 5);
|
|
|
|
action = skip_seconds.bind(this, 5);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'ArrowLeft':
|
|
|
|
case 'ArrowLeft':
|
|
|
|
|
|
|
|
case 'MediaTrackPrevious':
|
|
|
|
action = skip_seconds.bind(this, -5);
|
|
|
|
action = skip_seconds.bind(this, -5);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
case 'l':
|
|
|
@ -391,9 +419,11 @@ window.addEventListener('keydown', e => {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'N':
|
|
|
|
case 'N':
|
|
|
|
|
|
|
|
case 'MediaTrackNext':
|
|
|
|
action = next_video;
|
|
|
|
action = next_video;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
case 'P':
|
|
|
|
|
|
|
|
case 'MediaTrackPrevious':
|
|
|
|
// TODO: Add support to play back previous video.
|
|
|
|
// TODO: Add support to play back previous video.
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|