1
0
Fork 0
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:
Steve Hoffing 2024-06-09 13:34:12 -04:00 committed by Bill Thornton
parent 9a00a6c379
commit e28b55721d
2 changed files with 21 additions and 2 deletions

View file

@ -1775,6 +1775,10 @@ export default function (view) {
} }
}); });
nowPlayingPositionSlider.addEventListener('playpause', function () {
playbackManager.playPause(currentPlayer);
});
nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) { nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) {
showOsd(); showOsd();

View file

@ -521,6 +521,19 @@ function stepKeyboard(elem, delta) {
elem.dispatchEvent(event); 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 * Handle KeyDown event
*/ */
@ -541,9 +554,11 @@ function onKeyDown(e) {
case 'Enter': case 'Enter':
if (this.keyboardDragging) { if (this.keyboardDragging) {
finishKeyboardDragging(this); finishKeyboardDragging(this);
} else {
playPauseKeyboard(this);
}
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
}
break; break;
} }
} }