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);
|
playbackManager.playPause(currentPlayer);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) {
|
nowPlayingPositionSlider.updateBubbleHtml = function(bubble, value) {
|
||||||
|
|
|
@ -521,19 +521,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -554,11 +541,9 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue