From 7952b75ca24aaffeaac8834f24880e502f5e344e Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Sat, 15 Aug 2020 14:33:31 -0400 Subject: [PATCH 01/10] Show seek buttons when playing video on mobile. --- src/components/remotecontrol/remotecontrol.css | 15 ++++----------- src/components/remotecontrol/remotecontrol.js | 10 ++++++++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/remotecontrol/remotecontrol.css b/src/components/remotecontrol/remotecontrol.css index c260799585..1c31b4382b 100644 --- a/src/components/remotecontrol/remotecontrol.css +++ b/src/components/remotecontrol/remotecontrol.css @@ -222,18 +222,10 @@ margin: 0; } -.layout-mobile .nowPlayingSecondaryButtons .btnShuffleQueue { - display: none; -} - .layout-mobile .nowPlayingSecondaryButtons .volumecontrol { display: none; } -.layout-mobile .nowPlayingSecondaryButtons .btnRepeat { - display: none; -} - .layout-desktop .nowPlayingInfoButtons .btnRepeat, .layout-tv .nowPlayingInfoButtons .btnRepeat { display: none; @@ -362,7 +354,8 @@ border-radius: 0; } - .nowPlayingInfoButtons .btnRepeat { + .nowPlayingInfoButtons .btnRepeat, + .nowPlayingInfoButtons .btnRewind { position: absolute; left: 0; margin-left: 0; @@ -370,7 +363,8 @@ font-size: smaller; } - .nowPlayingInfoButtons .btnShuffleQueue { + .nowPlayingInfoButtons .btnShuffleQueue, + .nowPlayingInfoButtons .btnFastForward { position: absolute; right: 0; margin-right: 0; @@ -468,7 +462,6 @@ } @media all and (max-width: 63em) { - .nowPlayingSecondaryButtons .repeatToggleButton, .nowPlayingInfoButtons .playlist .listItemMediaInfo, .nowPlayingInfoButtons .btnStop { display: none !important; diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 6048c918c7..6a1355047c 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -332,8 +332,14 @@ export default function () { buttonVisible(context.querySelector('.btnNextTrack'), item != null); buttonVisible(context.querySelector('.btnPreviousTrack'), item != null); if (layoutManager.mobile) { - buttonVisible(context.querySelector('.btnRewind'), false); - buttonVisible(context.querySelector('.btnFastForward'), false); + const playingVideo = playbackManager.isPlayingVideo() && item != null; + const playingAudio = !playbackManager.isPlayingVideo() && item != null; + buttonVisible(context.querySelector('.btnRepeat'), playingAudio); + buttonVisible(context.querySelector('.btnShuffleQueue'), playingAudio); + buttonVisible(context.querySelector('.btnRewind'), playingVideo); + buttonVisible(context.querySelector('.btnFastForward'), playingVideo); + buttonVisible(context.querySelector('.nowPlayingSecondaryButtons .btnShuffleQueue'), playingVideo); + buttonVisible(context.querySelector('.nowPlayingSecondaryButtons .btnRepeat'), playingVideo); } else { buttonVisible(context.querySelector('.btnRewind'), item != null); buttonVisible(context.querySelector('.btnFastForward'), item != null); From dc162aca95711b119ddb1e331b86cd3666dd0467 Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Wed, 19 Aug 2020 19:19:23 -0400 Subject: [PATCH 02/10] Use strict equality check. Co-authored-by: Matjaz Zavski --- src/components/remotecontrol/remotecontrol.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 6a1355047c..ed463f67fe 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -332,8 +332,8 @@ export default function () { buttonVisible(context.querySelector('.btnNextTrack'), item != null); buttonVisible(context.querySelector('.btnPreviousTrack'), item != null); if (layoutManager.mobile) { - const playingVideo = playbackManager.isPlayingVideo() && item != null; - const playingAudio = !playbackManager.isPlayingVideo() && item != null; + const playingVideo = playbackManager.isPlayingVideo() && item !== null; + const playingAudio = !playbackManager.isPlayingVideo() && item !== null; buttonVisible(context.querySelector('.btnRepeat'), playingAudio); buttonVisible(context.querySelector('.btnShuffleQueue'), playingAudio); buttonVisible(context.querySelector('.btnRewind'), playingVideo); From 49edf39d52f166ae1dc62922b86b2a22b79eb2ff Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Tue, 25 Aug 2020 02:27:24 -0400 Subject: [PATCH 03/10] Fix video osd hiding remote seek buttons. --- src/assets/css/videoosd.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/assets/css/videoosd.css b/src/assets/css/videoosd.css index 59a485468d..fe19dde605 100644 --- a/src/assets/css/videoosd.css +++ b/src/assets/css/videoosd.css @@ -248,8 +248,8 @@ } @media all and (max-width: 30em) { - .btnFastForward, - .btnRewind, + .osdControls .btnFastForward, + .osdControls .btnRewind, .osdMediaInfo, .osdPoster { display: none !important; @@ -281,3 +281,4 @@ display: none !important; } } + From 6523de60b1634b62311adbdb5948ade0282dd5f2 Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Tue, 25 Aug 2020 02:32:48 -0400 Subject: [PATCH 04/10] Remove empty line for stylelint. --- src/assets/css/videoosd.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/assets/css/videoosd.css b/src/assets/css/videoosd.css index fe19dde605..2a28e9cff8 100644 --- a/src/assets/css/videoosd.css +++ b/src/assets/css/videoosd.css @@ -281,4 +281,3 @@ display: none !important; } } - From d25850b6969c3c103fb3c595304fdc11eea176aa Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Tue, 25 Aug 2020 22:14:53 -0400 Subject: [PATCH 05/10] Remove un-needed styles. --- src/assets/css/videoosd.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/assets/css/videoosd.css b/src/assets/css/videoosd.css index 2a28e9cff8..808915e58b 100644 --- a/src/assets/css/videoosd.css +++ b/src/assets/css/videoosd.css @@ -248,8 +248,6 @@ } @media all and (max-width: 30em) { - .osdControls .btnFastForward, - .osdControls .btnRewind, .osdMediaInfo, .osdPoster { display: none !important; From dbf1d4f811a762681497640c4b49fdca53a99dbd Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Tue, 25 Aug 2020 22:21:31 -0400 Subject: [PATCH 06/10] Add mediaType to isPlaying for remote players. --- src/plugins/chromecastPlayer/plugin.js | 4 ++-- src/plugins/sessionPlayer/plugin.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/chromecastPlayer/plugin.js b/src/plugins/chromecastPlayer/plugin.js index b7e6d05969..5ba8596089 100644 --- a/src/plugins/chromecastPlayer/plugin.js +++ b/src/plugins/chromecastPlayer/plugin.js @@ -931,9 +931,9 @@ class ChromecastPlayer { return state.VolumeLevel == null ? 100 : state.VolumeLevel; } - isPlaying() { + isPlaying(mediaType) { const state = this.lastPlayerData || {}; - return state.NowPlayingItem != null; + return state.NowPlayingItem != null && (state.NowPlayingItem.MediaType === mediaType || !mediaType); } isPlayingVideo() { diff --git a/src/plugins/sessionPlayer/plugin.js b/src/plugins/sessionPlayer/plugin.js index cbeb6f34b4..7e5dc9f4f7 100644 --- a/src/plugins/sessionPlayer/plugin.js +++ b/src/plugins/sessionPlayer/plugin.js @@ -466,9 +466,9 @@ class SessionPlayer { sendCommandByName(this, 'DisplayContent', options); } - isPlaying() { + isPlaying(mediaType) { const state = this.lastPlayerData || {}; - return state.NowPlayingItem != null; + return state.NowPlayingItem != null && (state.NowPlayingItem.MediaType === mediaType || !mediaType); } isPlayingVideo() { From 7eff82d671d2df4c65988e229984af98a15189b8 Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Tue, 25 Aug 2020 22:27:28 -0400 Subject: [PATCH 07/10] Add null check to remotecontrol. --- src/components/remotecontrol/remotecontrol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 8e1eb55a1d..fcadadcf30 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -134,7 +134,7 @@ function imageUrl(item, options) { function updateNowPlayingInfo(context, state, serverId) { const item = state.NowPlayingItem; const displayName = item ? getNowPlayingNameHtml(item).replace('
', ' - ') : ''; - if (typeof item !== 'undefined') { + if (typeof item !== 'undefined' && item !== null) { const nowPlayingServerId = (item.ServerId || serverId); if (item.Type == 'Audio' || item.MediaStreams[0].Type == 'Audio') { const songName = item.Name; From 9b6b79628f89bb6b7d87acf31187fef13f356c7a Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Wed, 26 Aug 2020 17:05:01 -0400 Subject: [PATCH 08/10] Switch to simple check for item. --- src/components/remotecontrol/remotecontrol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index fcadadcf30..befedfe1ac 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -134,7 +134,7 @@ function imageUrl(item, options) { function updateNowPlayingInfo(context, state, serverId) { const item = state.NowPlayingItem; const displayName = item ? getNowPlayingNameHtml(item).replace('
', ' - ') : ''; - if (typeof item !== 'undefined' && item !== null) { + if (item) { const nowPlayingServerId = (item.ServerId || serverId); if (item.Type == 'Audio' || item.MediaStreams[0].Type == 'Audio') { const songName = item.Name; From c22e3b2cc6b9a7b9a76f4c33fc9a5523936c9c67 Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Wed, 26 Aug 2020 17:18:23 -0400 Subject: [PATCH 09/10] Fix seriesImageUrl linter issue. --- src/components/remotecontrol/remotecontrol.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index befedfe1ac..b6bc74e98c 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -192,11 +192,11 @@ function updateNowPlayingInfo(context, state, serverId) { context.querySelector('.nowPlayingPageTitle').classList.add('hide'); } - const url = item ? seriesImageUrl(item, { + const url = seriesImageUrl(item, { maxHeight: 300 }) || imageUrl(item, { maxHeight: 300 - }) : null; + }); let contextButton = context.querySelector('.btnToggleContextMenu'); // We remove the previous event listener by replacing the item in each update event From e7b52072940f6236249ccabe6320114398da1fdd Mon Sep 17 00:00:00 2001 From: Ian Walton Date: Wed, 26 Aug 2020 18:35:20 -0400 Subject: [PATCH 10/10] Fix clearing backdrop when no item is playing. --- src/components/remotecontrol/remotecontrol.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index b6bc74e98c..8d6c53cead 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -228,18 +228,16 @@ function updateNowPlayingInfo(context, state, serverId) { }); }); setImageUrl(context, state, url); - if (item) { - backdrop.setBackdrops([item]); - apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) { - const userData = fullItem.UserData || {}; - const likes = userData.Likes == null ? '' : userData.Likes; - context.querySelector('.nowPlayingPageUserDataButtonsTitle').innerHTML = ''; - context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = ''; - }); - } else { - backdrop.clearBackdrop(); - context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = ''; - } + backdrop.setBackdrops([item]); + apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) { + const userData = fullItem.UserData || {}; + const likes = userData.Likes == null ? '' : userData.Likes; + context.querySelector('.nowPlayingPageUserDataButtonsTitle').innerHTML = ''; + context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = ''; + }); + } else { + backdrop.clearBackdrop(); + context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = ''; } }