Add item navigation to OSD
This commit is contained in:
parent
e488407ba5
commit
d9f714690e
|
@ -125,6 +125,11 @@ sub playQueue()
|
|||
return
|
||||
end if
|
||||
|
||||
if nextItemMediaType = "audiobook"
|
||||
CreateAudioPlayerView()
|
||||
return
|
||||
end if
|
||||
|
||||
if nextItemMediaType = "musicvideo"
|
||||
CreateVideoPlayerView()
|
||||
return
|
||||
|
|
|
@ -9,6 +9,8 @@ sub init()
|
|||
m.lastRecordedPositionTimestamp = 0
|
||||
m.scrubTimestamp = -1
|
||||
|
||||
m.playlistTypeCount = m.global.queueManager.callFunc("getQueueUniqueTypes").count()
|
||||
|
||||
setupAudioNode()
|
||||
setupAnimationTasks()
|
||||
setupButtons()
|
||||
|
@ -16,8 +18,6 @@ sub init()
|
|||
setupDataTasks()
|
||||
setupScreenSaver()
|
||||
|
||||
m.playlistTypeCount = m.global.queueManager.callFunc("getQueueUniqueTypes").count()
|
||||
|
||||
m.buttonCount = m.buttons.getChildCount()
|
||||
m.seekPosition.translation = [720 - (m.seekPosition.width / 2), m.seekPosition.translation[1]]
|
||||
|
||||
|
@ -102,6 +102,20 @@ end sub
|
|||
sub setupButtons()
|
||||
m.buttons = m.top.findNode("buttons")
|
||||
m.top.observeField("selectedButtonIndex", "onButtonSelectedChange")
|
||||
|
||||
' If we're playing a mixed playlist, remove the shuffle and loop buttons
|
||||
if m.playlistTypeCount > 1
|
||||
shuffleButton = m.top.findNode("shuffle")
|
||||
m.buttons.removeChild(shuffleButton)
|
||||
|
||||
loopButton = m.top.findNode("loop")
|
||||
m.buttons.removeChild(loopButton)
|
||||
|
||||
m.previouslySelectedButtonIndex = 0
|
||||
m.top.selectedButtonIndex = 1
|
||||
return
|
||||
end if
|
||||
|
||||
m.previouslySelectedButtonIndex = 1
|
||||
m.top.selectedButtonIndex = 2
|
||||
end sub
|
||||
|
@ -284,9 +298,17 @@ function playAction() as boolean
|
|||
end function
|
||||
|
||||
function previousClicked() as boolean
|
||||
if m.playlistTypeCount > 1 then return false
|
||||
if m.global.queueManager.callFunc("getPosition") = 0 then return false
|
||||
|
||||
if m.playlistTypeCount > 1
|
||||
m.global.audioPlayer.control = "stop"
|
||||
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveBack")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
return true
|
||||
end if
|
||||
|
||||
exitScrubMode()
|
||||
|
||||
m.lastRecordedPositionTimestamp = 0
|
||||
|
@ -339,7 +361,16 @@ sub setLoopButtonImage()
|
|||
end sub
|
||||
|
||||
function nextClicked() as boolean
|
||||
if m.playlistTypeCount > 1 then return false
|
||||
if m.playlistTypeCount > 1
|
||||
if m.global.queueManager.callFunc("getPosition") < m.global.queueManager.callFunc("getCount") - 1
|
||||
m.global.audioPlayer.control = "stop"
|
||||
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveForward")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
|
||||
exitScrubMode()
|
||||
|
||||
|
@ -433,9 +464,6 @@ end sub
|
|||
|
||||
' If we have more and 1 song to play, fade in the next and previous controls
|
||||
sub loadButtons()
|
||||
' Don't show audio buttons if we have a mixed playlist
|
||||
if m.playlistTypeCount > 1 then return
|
||||
|
||||
if m.global.queueManager.callFunc("getCount") > 1
|
||||
m.shuffleIndicator.opacity = ".4"
|
||||
m.loopIndicator.opacity = ".4"
|
||||
|
|
|
@ -18,8 +18,8 @@ sub init()
|
|||
m.top.observeField("playbackState", "onPlaybackStateChanged")
|
||||
m.top.observeField("itemTitleText", "onItemTitleTextChanged")
|
||||
|
||||
m.defaultButtonIndex = 1
|
||||
m.focusedButtonIndex = 1
|
||||
m.defaultButtonIndex = 2
|
||||
m.focusedButtonIndex = 2
|
||||
|
||||
m.videoControls.buttonFocused = m.defaultButtonIndex
|
||||
m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1
|
||||
|
@ -75,7 +75,7 @@ sub resetFocusToDefaultButton()
|
|||
m.videoControls.setFocus(true)
|
||||
m.focusedButtonIndex = m.defaultButtonIndex
|
||||
m.videoControls.getChild(m.defaultButtonIndex).focus = true
|
||||
m.videoControls.buttonFocused = 1
|
||||
m.videoControls.buttonFocused = m.defaultButtonIndex
|
||||
m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1
|
||||
end sub
|
||||
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
</ButtonGroup>
|
||||
|
||||
<ButtonGroup id="videoControls" itemSpacings="[20]" layoutDirection="horiz" horizAlignment="center" translation="[960,875]">
|
||||
<IconButton id="itemBack" background="#070707" focusBackground="#00a4dc" padding="35" icon="pkg:/images/icons/itemPrevious.png" height="65" width="100" />
|
||||
<IconButton id="chapterBack" background="#070707" focusBackground="#00a4dc" padding="16" icon="pkg:/images/icons/previousChapter.png" height="65" width="100" />
|
||||
<IconButton id="videoPlayPause" background="#070707" focusBackground="#00a4dc" padding="35" icon="pkg:/images/icons/play.png" height="65" width="100" />
|
||||
<IconButton id="chapterNext" background="#070707" focusBackground="#00a4dc" padding="16" icon="pkg:/images/icons/nextChapter.png" height="65" width="100" />
|
||||
<IconButton id="itemNext" background="#070707" focusBackground="#00a4dc" padding="35" icon="pkg:/images/icons/itemNext.png" height="65" width="100" />
|
||||
</ButtonGroup>
|
||||
|
||||
<Rectangle id="progressBarBackground" color="0x00000098" width="1714" height="8" translation="[103,970]">
|
||||
|
|
|
@ -92,6 +92,35 @@ sub handleChapterSkipAction(action as string)
|
|||
end if
|
||||
end sub
|
||||
|
||||
' handleItemSkipAction: Handles user command to skip items
|
||||
'
|
||||
' @param {string} action - skip action to take
|
||||
sub handleItemSkipAction(action as string)
|
||||
if action = "itemnext"
|
||||
' If there is something next in the queue, play it
|
||||
if m.global.queueManager.callFunc("getPosition") < m.global.queueManager.callFunc("getCount") - 1
|
||||
m.top.control = "stop"
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveForward")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
|
||||
if action = "itemback"
|
||||
' If there is something previous in the queue, play it
|
||||
if m.global.queueManager.callFunc("getPosition") > 0
|
||||
m.top.control = "stop"
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveBack")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
end sub
|
||||
|
||||
' handleHideAction: Handles action to hide OSD menu
|
||||
'
|
||||
' @param {boolean} resume - controls whether or not to resume video playback when sub is called
|
||||
|
@ -220,6 +249,11 @@ sub onOSDAction()
|
|||
handleShowVideoInfoPopupAction()
|
||||
return
|
||||
end if
|
||||
|
||||
if action = "itemback" or action = "itemnext"
|
||||
handleItemSkipAction(action)
|
||||
return
|
||||
end if
|
||||
end sub
|
||||
|
||||
' Only setup caption items if captions are allowed
|
||||
|
@ -558,7 +592,7 @@ sub onState(msg)
|
|||
m.top.backPressed = true
|
||||
else if m.top.state = "playing"
|
||||
|
||||
' Check if next episde is available
|
||||
' Check if next episode is available
|
||||
if isValid(m.top.showID)
|
||||
if m.top.showID <> "" and not m.checkedForNextEpisode and m.top.content.contenttype = 4
|
||||
m.getNextEpisodeTask.showID = m.top.showID
|
||||
|
|
BIN
images/icons/itemNext.png
Normal file
BIN
images/icons/itemNext.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
images/icons/itemPrevious.png
Normal file
BIN
images/icons/itemPrevious.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue
Block a user