apply suggestion make position slider navigable by keyboard

This commit is contained in:
grafixeyehero 2020-02-19 02:10:40 +03:00
parent 0e506a24b1
commit 7e58b448cd

View File

@ -1,4 +1,4 @@
define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageLoader", "playbackManager", "nowPlayingHelper", "events", "connectionManager", "apphost", "globalize", "cardStyle", "emby-itemscontainer", "css!./remotecontrol.css", "emby-ratingbutton"], function (browser, datetime, backdrop, libraryBrowser, listView, imageLoader, playbackManager, nowPlayingHelper, events, connectionManager, appHost, globalize) {
define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageLoader", "playbackManager", "nowPlayingHelper", "events", "connectionManager", "apphost", "globalize", "layoutManager", "userSettings", "cardStyle", "emby-itemscontainer", "css!./remotecontrol.css", "emby-ratingbutton"], function (browser, datetime, backdrop, libraryBrowser, listView, imageLoader, playbackManager, nowPlayingHelper, events, connectionManager, appHost, globalize, layoutManager, userSettings) {
"use strict";
function showAudioMenu(context, player, button, item) {
@ -228,6 +228,11 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
buttonVisible(context.querySelector(".btnFastForward"), null != item);
var positionSlider = context.querySelector(".nowPlayingPositionSlider");
if (positionSlider && item && item.RunTimeTicks) {
positionSlider.setKeyboardSteps(userSettings.skipBackLength() * 1000000 / item.RunTimeTicks,
userSettings.skipForwardLength() * 1000000 / item.RunTimeTicks);
}
if (positionSlider && !positionSlider.dragging) {
positionSlider.disabled = !playState.CanSeek;
var isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks;
@ -687,6 +692,12 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
context.querySelector(".sendMessageForm").addEventListener("submit", onMessageSubmit);
context.querySelector(".typeTextForm").addEventListener("submit", onSendStringSubmit);
events.on(playbackManager, "playerchange", onPlayerChange);
if (layoutManager.tv) {
var positionSlider = context.querySelector(".nowPlayingPositionSlider");
positionSlider.classList.add("focusable");
positionSlider.enableKeyboardDragging();
}
}
function onDialogClosed(e) {