From 7e58b448cd252edb6d1c0a1b5dc031128d7d3c55 Mon Sep 17 00:00:00 2001 From: grafixeyehero Date: Wed, 19 Feb 2020 02:10:40 +0300 Subject: [PATCH] apply suggestion make position slider navigable by keyboard --- src/components/remotecontrol/remotecontrol.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 29e7e8f42b..0316e19a0b 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -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) {