From 3ccf9167b55482c7d1148303be47554ac3eb665d Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Sat, 11 Nov 2023 17:30:06 -0500
Subject: [PATCH 1/3] Add progress bar to pause menu
---
components/video/PauseMenu.bs | 13 +++++++++++++
components/video/PauseMenu.xml | 12 +++++++++++-
components/video/VideoPlayerView.bs | 6 ++++++
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/components/video/PauseMenu.bs b/components/video/PauseMenu.bs
index e7b88ecbf..0de67a0cb 100644
--- a/components/video/PauseMenu.bs
+++ b/components/video/PauseMenu.bs
@@ -7,9 +7,14 @@ sub init()
m.inactivityTimer = m.top.findNode("inactivityTimer")
m.itemTitle = m.top.findNode("itemTitle")
m.videoPlayPause = m.top.findNode("videoPlayPause")
+ m.videoPositionTime = m.top.findNode("videoPositionTime")
+ m.videoRemainingTime = m.top.findNode("videoRemainingTime")
+ m.progressBar = m.top.findNode("progressBar")
+ m.progressBarBackground = m.top.findNode("progressBarBackground")
m.top.observeField("visible", "onVisibleChanged")
m.top.observeField("hasFocus", "onFocusChanged")
+ m.top.observeField("progressPercentage", "onProgressPercentageChanged")
m.top.observeField("playbackState", "onPlaybackStateChanged")
m.top.observeField("itemTitleText", "onItemTitleTextChanged")
@@ -23,6 +28,14 @@ sub init()
m.deviceInfo = CreateObject("roDeviceInfo")
end sub
+' onProgressPercentageChanged: Handler for changes to m.top.progressPercentage param
+'
+sub onProgressPercentageChanged()
+ m.videoPositionTime.text = secondsToHuman(m.top.positionTime)
+ m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime)
+ m.progressBar.width = m.progressBarBackground.width * m.top.progressPercentage
+end sub
+
' onPlaybackStateChanged: Handler for changes to m.top.playbackState param
'
sub onPlaybackStateChanged()
diff --git a/components/video/PauseMenu.xml b/components/video/PauseMenu.xml
index 899165927..b51703ce8 100644
--- a/components/video/PauseMenu.xml
+++ b/components/video/PauseMenu.xml
@@ -10,17 +10,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs
index 3314f479f..db915dc9f 100644
--- a/components/video/VideoPlayerView.bs
+++ b/components/video/VideoPlayerView.bs
@@ -437,6 +437,12 @@ end sub
' When Video Player state changes
sub onPositionChanged()
+
+ ' Pass video position data into pause menu
+ m.pauseMenu.progressPercentage = m.top.position / m.top.duration
+ m.pauseMenu.positionTime = m.top.position
+ m.pauseMenu.remainingPositionTime = m.top.duration - m.top.position
+
if isValid(m.captionTask)
m.captionTask.currentPos = Int(m.top.position * 1000)
end if
From 8f7b5f8054cb8cc52e30c86590b645d59a9e92fe Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Sun, 12 Nov 2023 07:58:11 -0500
Subject: [PATCH 2/3] Change font and position to match trickplay. Fix double
trickplay bar
---
components/video/PauseMenu.xml | 8 ++++----
components/video/VideoPlayerView.bs | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/components/video/PauseMenu.xml b/components/video/PauseMenu.xml
index b51703ce8..d79f4f4e5 100644
--- a/components/video/PauseMenu.xml
+++ b/components/video/PauseMenu.xml
@@ -1,7 +1,7 @@
-
+
@@ -16,12 +16,12 @@
-
+
-
-
+
+
diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs
index db915dc9f..e13511c30 100644
--- a/components/video/VideoPlayerView.bs
+++ b/components/video/VideoPlayerView.bs
@@ -618,7 +618,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
- if key = "down"
+ if key = "down" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
m.pauseMenu.visible = true
m.pauseMenu.hasFocus = true
@@ -626,7 +626,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true
end if
- else if key = "up"
+ else if key = "up" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
m.pauseMenu.visible = true
m.pauseMenu.hasFocus = true
From 9de99afa926ac515254e9f8c6148b2c8b76acb30 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Sun, 12 Nov 2023 12:30:53 -0500
Subject: [PATCH 3/3] Add leading zero to minutes in pause bar
---
components/music/AudioPlayerView.bs | 2 +-
components/video/PauseMenu.bs | 4 ++--
source/utils/misc.bs | 29 ++++++++++++++++++++++-------
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/components/music/AudioPlayerView.bs b/components/music/AudioPlayerView.bs
index 73caa78bb..4858ee402 100644
--- a/components/music/AudioPlayerView.bs
+++ b/components/music/AudioPlayerView.bs
@@ -165,7 +165,7 @@ sub audioPositionChanged()
' Update displayed position timestamp
if isValid(m.global.audioPlayer.position)
- m.positionTimestamp.text = secondsToHuman(m.global.audioPlayer.position)
+ m.positionTimestamp.text = secondsToHuman(m.global.audioPlayer.position, false)
else
m.positionTimestamp.text = "0:00"
end if
diff --git a/components/video/PauseMenu.bs b/components/video/PauseMenu.bs
index 0de67a0cb..296d944d6 100644
--- a/components/video/PauseMenu.bs
+++ b/components/video/PauseMenu.bs
@@ -31,8 +31,8 @@ end sub
' onProgressPercentageChanged: Handler for changes to m.top.progressPercentage param
'
sub onProgressPercentageChanged()
- m.videoPositionTime.text = secondsToHuman(m.top.positionTime)
- m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime)
+ m.videoPositionTime.text = secondsToHuman(m.top.positionTime, true)
+ m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true)
m.progressBar.width = m.progressBarBackground.width * m.top.progressPercentage
end sub
diff --git a/source/utils/misc.bs b/source/utils/misc.bs
index d2d81d31c..3aae717a2 100644
--- a/source/utils/misc.bs
+++ b/source/utils/misc.bs
@@ -43,16 +43,31 @@ function ticksToHuman(ticks as longinteger) as string
return r
end function
-function secondsToHuman(totalSeconds as integer) as string
+function secondsToHuman(totalSeconds as integer, addLeadingMinuteZero as boolean) as string
+ humanTime = ""
hours = stri(int(totalSeconds / 3600)).trim()
minutes = stri(int((totalSeconds - (val(hours) * 3600)) / 60)).trim()
seconds = stri(totalSeconds - (val(hours) * 3600) - (val(minutes) * 60)).trim()
- if val(hours) > 0 and val(minutes) < 10 then minutes = "0" + minutes
- if val(seconds) < 10 then seconds = "0" + seconds
- r = ""
- if val(hours) > 0 then r = hours + ":"
- r = r + minutes + ":" + seconds
- return r
+
+ if val(hours) > 0 or addLeadingMinuteZero
+ if val(minutes) < 10
+ minutes = "0" + minutes
+ end if
+ end if
+
+ if val(seconds) < 10
+ seconds = "0" + seconds
+ end if
+
+ if val(hours) > 0
+ hours = hours + ":"
+ else
+ hours = ""
+ end if
+
+ humanTime = hours + minutes + ":" + seconds
+
+ return humanTime
end function
' Format time as 12 or 24 hour format based on system clock setting