play/pause when Enter is pressed on non-dragging position slider
This commit is contained in:
committed by
Bill Thornton
parent
9a00a6c379
commit
e28b55721d
@@ -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);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
playPauseKeyboard(this);
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user