From 21b3fce2664d184e1a0b7b10e8e3bc09043e503d Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sun, 29 Oct 2023 11:06:28 -0400 Subject: [PATCH 1/2] Only show the "Next Episode" button for episodes --- components/video/VideoPlayerView.brs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/video/VideoPlayerView.brs b/components/video/VideoPlayerView.brs index b4f47948..bafcf185 100644 --- a/components/video/VideoPlayerView.brs +++ b/components/video/VideoPlayerView.brs @@ -218,6 +218,9 @@ end sub ' Checks if we need to display the Next Episode button sub checkTimeToDisplayNextEpisode() + ' only display the Next Episode button when the content is type "Episode" + if m.top.content.contenttype <> 4 then return + if int(m.top.position) >= (m.top.duration - 30) showNextEpisodeButton() updateCount() From 2fbf96890108b1d802a1bcb615acdea4bd2a28a7 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Sun, 29 Oct 2023 14:49:55 -0400 Subject: [PATCH 2/2] use opacity for next episode check and hide button before it reaches 0 --- components/JFVideo.brs | 32 ++++++++++++++++------- components/JFVideo.xml | 2 +- components/video/VideoPlayerView.brs | 39 ++++++++++++++++++++-------- components/video/VideoPlayerView.xml | 2 +- 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/components/JFVideo.brs b/components/JFVideo.brs index cebacb03..5ae0af9a 100644 --- a/components/JFVideo.brs +++ b/components/JFVideo.brs @@ -90,10 +90,13 @@ end sub ' ' Runs Next Episode button animation and sets focus to button sub showNextEpisodeButton() - if m.global.session.user.configuration.EnableNextEpisodeAutoPlay and not m.nextEpisodeButton.visible + if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode" + if m.nextupbuttonseconds = 0 then return ' is the button disabled? + + if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay + m.nextEpisodeButton.visible = true m.showNextEpisodeButtonAnimation.control = "start" m.nextEpisodeButton.setFocus(true) - m.nextEpisodeButton.visible = true end if end sub @@ -117,13 +120,22 @@ end sub ' Checks if we need to display the Next Episode button sub checkTimeToDisplayNextEpisode() - if m.top.content.contenttype <> 4 then return - if m.nextupbuttonseconds = 0 then return + if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode" + if m.nextupbuttonseconds = 0 then return ' is the button disabled? - if int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds) - showNextEpisodeButton() - updateCount() - return + if isValid(m.top.duration) and isValid(m.top.position) + nextEpisodeCountdown = Int(m.top.duration - m.top.position) + + if nextEpisodeCountdown < 0 and m.nextEpisodeButton.opacity = 0.9 + hideNextEpisodeButton() + return + else if nextEpisodeCountdown > 1 and int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds - 1) + updateCount() + if m.nextEpisodeButton.opacity = 0 + showNextEpisodeButton() + end if + return + end if end if if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus() @@ -266,8 +278,8 @@ function onKeyEvent(key as string, press as boolean) as boolean return true else 'Hide Next Episode Button - if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus() - m.nextEpisodeButton.visible = false + if m.nextEpisodeButton.opacity > 0 or m.nextEpisodeButton.hasFocus() + m.nextEpisodeButton.opacity = 0 m.nextEpisodeButton.setFocus(false) m.top.setFocus(true) end if diff --git a/components/JFVideo.xml b/components/JFVideo.xml index 8ad34d79..57ae3c68 100644 --- a/components/JFVideo.xml +++ b/components/JFVideo.xml @@ -40,7 +40,7 @@ - + diff --git a/components/video/VideoPlayerView.brs b/components/video/VideoPlayerView.brs index bafcf185..5d5d8023 100644 --- a/components/video/VideoPlayerView.brs +++ b/components/video/VideoPlayerView.brs @@ -41,6 +41,7 @@ sub init() m.nextEpisodeButton = m.top.findNode("nextEpisode") m.nextEpisodeButton.text = tr("Next Episode") m.nextEpisodeButton.setFocus(false) + m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"].ToInt() m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton") m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton") @@ -195,17 +196,24 @@ end sub ' ' Runs Next Episode button animation and sets focus to button sub showNextEpisodeButton() - if m.global.session.user.configuration.EnableNextEpisodeAutoPlay and not m.nextEpisodeButton.visible + if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode" + if m.nextupbuttonseconds = 0 then return ' is the button disabled? + + if m.nextEpisodeButton.opacity = 0 and m.global.session.user.configuration.EnableNextEpisodeAutoPlay + m.nextEpisodeButton.visible = true m.showNextEpisodeButtonAnimation.control = "start" m.nextEpisodeButton.setFocus(true) - m.nextEpisodeButton.visible = true end if end sub ' 'Update count down text sub updateCount() - m.nextEpisodeButton.text = tr("Next Episode") + " " + Int(m.top.duration - m.top.position).toStr() + nextEpisodeCountdown = Int(m.top.duration - m.top.position) + if nextEpisodeCountdown < 0 + nextEpisodeCountdown = 0 + end if + m.nextEpisodeButton.text = tr("Next Episode") + " " + nextEpisodeCountdown.toStr() end sub ' @@ -218,13 +226,22 @@ end sub ' Checks if we need to display the Next Episode button sub checkTimeToDisplayNextEpisode() - ' only display the Next Episode button when the content is type "Episode" - if m.top.content.contenttype <> 4 then return + if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode" + if m.nextupbuttonseconds = 0 then return ' is the button disabled? - if int(m.top.position) >= (m.top.duration - 30) - showNextEpisodeButton() - updateCount() - return + if isValid(m.top.duration) and isValid(m.top.position) + nextEpisodeCountdown = Int(m.top.duration - m.top.position) + + if nextEpisodeCountdown < 0 and m.nextEpisodeButton.opacity = 0.9 + hideNextEpisodeButton() + return + else if nextEpisodeCountdown > 1 and int(m.top.position) >= (m.top.duration - m.nextupbuttonseconds - 1) + updateCount() + if m.nextEpisodeButton.opacity = 0 + showNextEpisodeButton() + end if + return + end if end if if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus() @@ -366,8 +383,8 @@ function onKeyEvent(key as string, press as boolean) as boolean return true else 'Hide Next Episode Button - if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus() - m.nextEpisodeButton.visible = false + if m.nextEpisodeButton.opacity > 0 or m.nextEpisodeButton.hasFocus() + m.nextEpisodeButton.opacity = 0 m.nextEpisodeButton.setFocus(false) m.top.setFocus(true) end if diff --git a/components/video/VideoPlayerView.xml b/components/video/VideoPlayerView.xml index 609cfc11..e86a591a 100644 --- a/components/video/VideoPlayerView.xml +++ b/components/video/VideoPlayerView.xml @@ -36,7 +36,7 @@ - +