Fix to exiting playback and changing subtitle settings

This commit is contained in:
thomabx 2020-03-18 20:56:56 -07:00
parent 63602307cd
commit fac7d8fdd0
2 changed files with 37 additions and 30 deletions

View File

@ -43,34 +43,15 @@ sub Main()
print "CLOSING SCREEN"
return
else if isNodeEvent(msg, "backPressed")
if msg.getRoSGNode().focusedChild <> invalid and msg.getRoSGNode().focusedChild.isSubtype("JFVideo")
stopPlayback()
end if
' Pop a group off the stack and expose what's below
n = m.scene.getChildCount() - 1
if n = 1
' Overhang + last scene... this is the end
return
if msg.getRoSGNode().focusedChild <> invalid and msg.getRoSGNode().focusedChild.isSubtype("JFVideo")
print "backPressed on video"
stopPlayback()
else
if n = 1 then return
RemoveCurrentGroup()
end if
m.scene.removeChildIndex(n)
prevOptionsAvailable = group.optionsAvailable
group = m.scene.getChild(n-1)
m.overhang.title = group.overhangTitle
m.overhang.showOptions = group.optionsAvailable
if group.optionsAvailable <> prevOptionsAvailable then
if group.optionsAvailable = false then
m.scene.unobserveField("optionsPressed")
else
m.scene.observeField("optionsPressed", m.port)
end if
end if
m.overhang.visible = true
if group.lastFocus <> invalid
group.lastFocus.setFocus(true)
else
group.setFocus(true)
end if
group.visible = true
else if isNodeEvent(msg, "optionsPressed")
group.lastFocus = group.focusedChild
panel = group.findNode("options")
@ -340,15 +321,14 @@ sub Main()
else if isNodeEvent(msg, "position")
video = msg.getRoSGNode()
if video.position >= video.duration then
video.control = "stop"
video.state = "finished"
stopPlayback()
end if
else if isNodeEvent(msg, "fire")
ReportPlayback(group, "update")
else if isNodeEvent(msg, "state")
node = msg.getRoSGNode()
if node.state = "finished" then
node.backPressed = "true"
stopPlayback()
else if node.state = "playing" or node.state = "paused" then
ReportPlayback(group, "update")
end if
@ -365,7 +345,7 @@ sub Main()
else if event.Mute <> invalid then
m.mute = event.Mute
child = m.scene.focusedChild
if child <> invalid and child.isSubType("JFVideo") and child.systemOverlay = false then
if child <> invalid and child.isSubType("JFVideo") and areSubtitlesDisplayed() and child.systemOverlay = false then
'Event will be called on caption change which includes the current mute status, but we do not want to call until the overlay is closed
reviewSubtitleDisplay()
end if
@ -431,3 +411,29 @@ sub wipe_groups()
m.scene.removeChildIndex(1)
end while
end sub
sub RemoveCurrentGroup()
' Pop a group off the stack and expose what's below
n = m.scene.getChildCount() - 1
group = m.scene.focusedChild
m.scene.removeChildIndex(n)
prevOptionsAvailable = group.optionsAvailable
group = m.scene.getChild(n - 1)
m.overhang.title = group.overhangTitle
m.overhang.showOptions = group.optionsAvailable
if group.optionsAvailable <> prevOptionsAvailable then
if group.optionsAvailable = false then
m.scene.unobserveField("optionsPressed")
else
m.scene.observeField("optionsPressed", m.port)
end if
end if
m.overhang.visible = true
if group.lastFocus <> invalid
print "lastfocus" group.lastfocus
group.lastFocus.setFocus(true)
else
group.setFocus(true)
end if
group.visible = true
end sub

View File

@ -190,10 +190,11 @@ end function
function StopPlayback()
video = m.scene.focusedchild
video.control = "stop"
m.device.EnableAppFocusEvent(False)
video.findNode("playbackTimer").control = "stop"
video.control = "stop"
video.visible = "false"
if video.status = "finished" then MarkItemWatched(video.id)
ReportPlayback(video, "stop")
RemoveCurrentGroup()
end function