Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jellyfin-bot committed Nov 12, 2023
1 parent 1037fe0 commit 04dd79a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/api/components_music_AudioPlayerView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

' 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
Expand Down
13 changes: 13 additions & 0 deletions docs/api/components_video_PauseMenu.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
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")

Expand All @@ -25,6 +30,14 @@
m.deviceInfo = CreateObject("roDeviceInfo")
end sub

' onProgressPercentageChanged: Handler for changes to m.top.progressPercentage param
'
sub onProgressPercentageChanged()
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

' onPlaybackStateChanged: Handler for changes to m.top.playbackState param
'
sub onPlaybackStateChanged()
Expand Down
10 changes: 8 additions & 2 deletions docs/api/components_video_VideoPlayerView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@

' 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
Expand Down Expand Up @@ -614,15 +620,15 @@

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
m.pauseMenu.setFocus(true)
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
Expand Down
2 changes: 1 addition & 1 deletion docs/api/data/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-PauseMenu.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-misc.html

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions docs/api/source_utils_misc.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,31 @@
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
Expand Down

0 comments on commit 04dd79a

Please sign in to comment.