mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
play/pause when Enter is pressed on non-dragging position slider
This commit is contained in:
parent
9a00a6c379
commit
e28b55721d
2 changed files with 21 additions and 2 deletions
|
@ -1775,6 +1775,10 @@ export default function (view) {
|
|||
}
|
||||
});
|
||||
|
||||
nowPlayingPositionSlider.addEventListener('playpause', function () {
|
||||
playbackManager.playPause(currentPlayer);
|
||||
});
|
||||
|
||||
nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) {
|
||||
showOsd();
|
||||
|
||||
|
|
|
@ -521,6 +521,19 @@ function stepKeyboard(elem, delta) {
|
|||
elem.dispatchEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Play or pause video.
|
||||
*
|
||||
* @param {Object} elem slider itself
|
||||
*/
|
||||
function playPauseKeyboard(elem) {
|
||||
const event = new Event('playpause', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
});
|
||||
elem.dispatchEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle KeyDown event
|
||||
*/
|
||||
|
@ -541,9 +554,11 @@ function onKeyDown(e) {
|
|||
case 'Enter':
|
||||
if (this.keyboardDragging) {
|
||||
finishKeyboardDragging(this);
|
||||
} else {
|
||||
playPauseKeyboard(this);
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue