1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
Alessandro Tassinari 2025-03-30 11:03:15 -04:00 committed by GitHub
commit a6c01cdfe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 2 deletions

View file

@ -96,6 +96,7 @@
- [K. Kyle Puchkov](https://github.com/kepper104)
- [ItsAllAboutTheCode](https://github.com/ItsAllAboutTheCode)
- [Jxiced](https://github.com/Jxiced)
- [Ale4224](https://github.com/Ale4224)
## Emby Contributors

View file

@ -1214,6 +1214,10 @@ export default function (view) {
}
}
let spaceKeyTimeout;
let isSpaceKeyDown = false;
let isSpaceKeyHeld = false;
function onKeyDown(e) {
clickedElement = e.target;
@ -1228,8 +1232,16 @@ export default function (view) {
if (e.keyCode === 32) {
if (e.target.tagName !== 'BUTTON' || !layoutManager.tv) {
playbackManager.playPause(currentPlayer);
showOsd(btnPlayPause);
if (!isSpaceKeyDown) {
isSpaceKeyDown = true;
isSpaceKeyHeld = false;
spaceKeyTimeout = setTimeout(() => {
isSpaceKeyHeld = true;
playbackManager.setPlaybackRate(2, currentPlayer);
}, 500);
}
e.preventDefault();
e.stopPropagation();
// Trick Firefox with a null element to skip next click
@ -1430,6 +1442,27 @@ export default function (view) {
}
}
function onKeyUp(e) {
if (e.keyCode === 32) {
if (isSpaceKeyDown) {
if (isSpaceKeyHeld) {
playbackManager.setPlaybackRate(1, currentPlayer);
} else {
playbackManager.playPause(currentPlayer);
showOsd(osdBottomElement.querySelector('.btnPause'));
}
if (spaceKeyTimeout) {
clearTimeout(spaceKeyTimeout);
spaceKeyTimeout = null;
}
isSpaceKeyDown = false;
isSpaceKeyHeld = false;
}
}
}
function onKeyDownCapture() {
resetIdle();
}
@ -1680,6 +1713,7 @@ export default function (view) {
showOsd();
inputManager.on(window, onInputCommand);
document.addEventListener('keydown', onKeyDown);
document.addEventListener('keyup', onKeyUp);
dom.addEventListener(document, 'keydown', onKeyDownCapture, {
capture: true,
passive: true
@ -1723,6 +1757,7 @@ export default function (view) {
}
document.removeEventListener('keydown', onKeyDown);
document.removeEventListener('keyup', onKeyUp);
dom.removeEventListener(document, 'keydown', onKeyDownCapture, {
capture: true,
passive: true