1
在「Scene Graph XML Tutorial」中的「視頻列表標記」示例中,當我選擇一個項目「itemSelected」時,我想重寫「playVideo」,因此它是創建一個roScreen,以便我可以在其上繪製自己的圖像。可能嗎?我需要幫助修改其中一個示例以啓動roScreen
sub init()
m.top.backgroundURI = "pkg:/images/rsgde_bg_hd.jpg"
m.videolist = m.top.findNode("videoLabelList")
m.videoinfo = m.top.findNode("infoLabel")
m.videoposter = m.top.findNode("videoPoster")
m.video = m.top.findNode("exampleVideo")
m.video.observeField("state", "controlvideoplay")
m.readVideoContentTask = createObject("roSGNode", "ContentReader")
m.readVideoContentTask.observeField("content", "showvideolist")
m.readVideoContentTask.control = "RUN"
m.videolist.observeField("itemFocused", "setvideo")
m.videolist.observeField("itemSelected", "playvideo")
end sub
Sub OnChangeXmlstringscene()
m.readVideoContentTask.xmlstring = m.top.xmlstringscene
End Sub
sub showvideolist()
m.videolist.content = m.readVideoContentTask.content
m.videolist.setFocus(true)
end sub
sub setvideo()
videocontent = m.videolist.content.getChild(m.videolist.itemFocused)
m.videoposter.uri = videocontent.hdposterurl
m.videoinfo.text = videocontent.description
m.video.content = videocontent
end sub
sub playvideo()
m.video.control = "play"
m.video.visible = true
m.video.setFocus(true)
end sub
sub controlvideoplay()
if (m.video.state = "finished")
m.video.control = "stop"
m.videolist.setFocus(true)
m.video.visible = false
end if
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean
if press then
if key = "back"
if (m.video.state = "playing")
m.video.control = "stop"
m.videolist.setFocus(true)
m.video.visible = false
return true
end if
end if
end if
return false
end function
如果這是不可能的,我怎麼能代替視頻播放屏幕的畫面,讓我在其上描繪自己的JPG圖片?
@ioanghip - 嗯,您可以預先在場景的XML描述符文件中添加海報,稍後再將其展開並使其可見或更新URL。或者您可以在運行時以編程方式創建/添加節點到場景。 –
SDK2很難。不是故意的,但仍然。如果您必須使用它,請閱讀教程,希望能夠澄清一些內容,https://sdkdocs.roku.com/display/sdkdoc/Scene+Graph+XML+Tutorial –
「如果您必須使用它」,則有選擇嗎?我知道的唯一的另一個選擇是使用屏幕......但是如果大多數「舊東西」已被棄用,我將如何使用屏幕創建界面,並且截至2017年7月1日Roku將不接受任何使用這些東西的頻道... –