Added extra playback keybindings, following YouTube's spec at https://support.google.com/youtube/answer/7631406?hl=en

This commit is contained in:
Mike Abrahall 2020-02-21 16:08:23 +11:00
parent b3fa02cbc1
commit 14f72baf16

View File

@ -1119,6 +1119,14 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
playbackManager.playPause(currentPlayer); playbackManager.playPause(currentPlayer);
showOsd(); showOsd();
break; break;
case "ArrowUp":
case "Up":
playbackManager.volumeUp(currentPlayer);
break;
case "ArrowDown":
case "Down":
playbackManager.volumeDown(currentPlayer);
break;
case "l": case "l":
case "ArrowRight": case "ArrowRight":
case "Right": case "Right":
@ -1141,6 +1149,18 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
playbackManager.toggleMute(currentPlayer); playbackManager.toggleMute(currentPlayer);
showOsd(); showOsd();
break; break;
case "p":
case "P":
if (e.shiftKey) {
playbackManager.previousTrack(currentPlayer);
}
break;
case "n":
case "N":
if (e.shiftKey) {
playbackManager.nextTrack(currentPlayer);
}
break;
case "NavigationLeft": case "NavigationLeft":
case "GamepadDPadLeft": case "GamepadDPadLeft":
case "GamepadLeftThumbstickLeft": case "GamepadLeftThumbstickLeft":
@ -1158,6 +1178,29 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
playbackManager.fastForward(currentPlayer); playbackManager.fastForward(currentPlayer);
showOsd(); showOsd();
} }
//
case "Home":
playbackManager.seekPercent(0, currentPlayer);
break;
case "End":
// Honestly this binding seems kind of pointless, just use 'nextTrack',
// but YouTube has this one and that's the standard I'm aiming for
playbackManager.seekPercent(100, currentPlayer);
break;
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
var percent = parseInt(key);
percent *= 10;
playbackManager.seekPercent(percent, currentPlayer);
break;
} }
} }