mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use a 'keydown' listener in video/index.js instead
This commit is contained in:
parent
e28b55721d
commit
5ef0428bba
2 changed files with 9 additions and 19 deletions
|
@ -1775,8 +1775,13 @@ export default function (view) {
|
|||
}
|
||||
});
|
||||
|
||||
nowPlayingPositionSlider.addEventListener('playpause', function () {
|
||||
nowPlayingPositionSlider.addEventListener('keydown', function (e) {
|
||||
if (e.defaultPrevented) return;
|
||||
|
||||
const key = keyboardnavigation.getKeyName(e);
|
||||
if (key === 'Enter') {
|
||||
playbackManager.playPause(currentPlayer);
|
||||
}
|
||||
});
|
||||
|
||||
nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) {
|
||||
|
|
|
@ -521,19 +521,6 @@ 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
|
||||
*/
|
||||
|
@ -554,11 +541,9 @@ 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