diff --git a/components/JFVideo.brs b/components/JFVideo.brs index a6fe67fc..7054bfd6 100644 --- a/components/JFVideo.brs +++ b/components/JFVideo.brs @@ -19,6 +19,7 @@ sub init() m.nextEpisodeButton = m.top.findNode("nextEpisode") m.nextEpisodeButton.text = tr("Next Episode") m.nextEpisodeButton.setFocus(false) + m.nextupbuttonseconds = get_user_setting("playback.nextupbuttonseconds", "30") m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton") m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton") @@ -64,7 +65,11 @@ end sub ' 'Update count down text sub updateCount() - m.nextEpisodeButton.text = tr("Next Episode") + " " + Int(m.top.runTime - m.top.position).toStr() + nextEpisodeCountdown = Int(m.top.runTime - m.top.position) + if nextEpisodeCountdown < 0 + nextEpisodeCountdown = 0 + end if + m.nextEpisodeButton.text = tr("Next Episode") + " " + nextEpisodeCountdown.toStr() end sub ' @@ -77,7 +82,13 @@ end sub ' Checks if we need to display the Next Episode button sub checkTimeToDisplayNextEpisode() - if int(m.top.position) >= (m.top.runTime - 30) + nextEpisodeCountdown = Int(m.top.runTime - m.top.position) + if nextEpisodeCountdown < 0 + hideNextEpisodeButton() + return + end if + + if int(m.top.position) >= (m.top.runTime - Val(m.nextupbuttonseconds)) showNextEpisodeButton() updateCount() return @@ -112,11 +123,10 @@ sub onState(msg) m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding else ' If an error was encountered, Display dialog - dialog = createObject("roSGNode", "Dialog") + dialog = createObject("roSGNode", "PlaybackDialog") dialog.title = tr("Error During Playback") dialog.buttons = [tr("OK")] dialog.message = tr("An error was encountered while playing this item.") - dialog.observeField("buttonSelected", "dialogClosed") m.top.getScene().dialog = dialog end if @@ -197,11 +207,10 @@ sub bufferCheck(msg) m.top.callFunc("refresh") else ' If buffering has stopped Display dialog - dialog = createObject("roSGNode", "Dialog") + dialog = createObject("roSGNode", "PlaybackDialog") dialog.title = tr("Error Retrieving Content") dialog.buttons = [tr("OK")] dialog.message = tr("There was an error retrieving the data for this item from the server.") - dialog.observeField("buttonSelected", "dialogClosed") m.top.getScene().dialog = dialog ' Stop playback and exit player @@ -212,14 +221,6 @@ sub bufferCheck(msg) end sub -' -' Clean up on Dialog Closed -sub dialogClosed(msg) - sourceNode = msg.getRoSGNode() - sourceNode.unobserveField("buttonSelected") - sourceNode.close = true -end sub - function onKeyEvent(key as string, press as boolean) as boolean if key = "OK" and m.nextEpisodeButton.hasfocus() and not m.top.trickPlayBar.visible diff --git a/components/PlaybackDialog.brs b/components/PlaybackDialog.brs new file mode 100644 index 00000000..3665c241 --- /dev/null +++ b/components/PlaybackDialog.brs @@ -0,0 +1,9 @@ +function onKeyEvent(key as string, press as boolean) as boolean + + if key = "OK" + m.top.close = true + return true + end if + + return false +end function diff --git a/components/PlaybackDialog.xml b/components/PlaybackDialog.xml new file mode 100644 index 00000000..6966e5d2 --- /dev/null +++ b/components/PlaybackDialog.xml @@ -0,0 +1,6 @@ + + + + +