Quick play videos with play button on home screen

This commit is contained in:
cewert 2020-12-08 03:39:58 -05:00
parent 9f0f8375a5
commit a44de34b24
5 changed files with 32 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<interface> <interface>
<field id="selectedItem" alias="homeRows.selectedItem" /> <field id="selectedItem" alias="homeRows.selectedItem" />
<field id="userConfig" alias="homeRows.userConfig" /> <field id="userConfig" alias="homeRows.userConfig" />
<field id="quickPlayNode" alias="homeRows.quickPlayNode" />
<field id="timeLastRefresh" type="integer" /> <field id="timeLastRefresh" type="integer" />
<function name="refresh" /> <function name="refresh" />
</interface> </interface>

View File

@ -306,7 +306,17 @@ function itemSelected()
end function end function
function onKeyEvent(key as string, press as boolean) as boolean function onKeyEvent(key as string, press as boolean) as boolean
return false handled = false
if press then
if key = "play" then
itemToPlay = m.top.content.getChild(m.top.rowItemFocused[0]).getChild(m.top.rowItemFocused[1])
if itemToPlay <> invalid and (itemToPlay.type = "Movie" or itemToPlay.type = "Episode") then
m.top.quickPlayNode = itemToPlay
end if
handled = true
end if
end if
return handled
end function end function
function filterNodeArray(nodeArray as object, nodeKey as string, excludeArray as object) as object function filterNodeArray(nodeArray as object, nodeKey as string, excludeArray as object) as object

View File

@ -3,6 +3,7 @@
<interface> <interface>
<field id="selectedItem" type="node" alwaysNotify="true" /> <field id="selectedItem" type="node" alwaysNotify="true" />
<field id="userConfig" type="assocarray" /> <field id="userConfig" type="assocarray" />
<field id="quickPlayNode" type="node" alwaysNotify="true" />
<function name="updateHomeRows" /> <function name="updateHomeRows" />
</interface> </interface>
<script type="text/brightscript" uri="HomeRows.brs"/> <script type="text/brightscript" uri="HomeRows.brs"/>

View File

@ -80,6 +80,24 @@ sub Main()
else else
group.setFocus(true) group.setFocus(true)
end if end if
else if isNodeEvent(msg, "quickPlayNode")
reportingNode = msg.getRoSGNode()
itemNode = reportingNode.quickPlayNode
if itemNode = invalid or itemNode.id = "" then return
if itemNode.type = "Episode" or itemNode.type = "Movie" or itemNode.type = "Video" then
video = CreateVideoPlayerGroup(itemNode.id)
if video <> invalid then
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
group = video
m.scene.appendChild(group)
group.setFocus(true)
group.control = "play"
ReportPlayback(group, "start")
m.overhang.visible = false
end if
end if
else if isNodeEvent(msg, "selectedItem") else if isNodeEvent(msg, "selectedItem")
' If you select a library from ANYWHERE, follow this flow ' If you select a library from ANYWHERE, follow this flow
selectedItem = msg.getData() selectedItem = msg.getData()

View File

@ -159,6 +159,7 @@ function CreateHomeGroup()
group = CreateObject("roSGNode", "Home") group = CreateObject("roSGNode", "Home")
group.observeField("selectedItem", m.port) group.observeField("selectedItem", m.port)
group.observeField("quickPlayNode", m.port)
sidepanel = group.findNode("options") sidepanel = group.findNode("options")
sidepanel.observeField("closeSidePanel", m.port) sidepanel.observeField("closeSidePanel", m.port)