我需要帮助修改其中一个示例以启动 roScreen
I need help modifying one of the examples to start a roScreen
在 "Scene Graph XML Tutorial" 的示例 "Video List Markup" 中,当我 select 一个项目 "itemSelected" 时,我想重写 "playVideo" 所以它正在创建一个 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 图片的屏幕?
roScreen
和其他 Roku SDK1 视觉组件通常与 SDK2(又名 RSG,"scene graph")组件不兼容。
所以不,您不能(或者您不尝试)在 RSG 模式下使用 roScreen。
但是您可以通过向场景添加一个 Poster 节点来做您想做的事。
在 "Scene Graph XML Tutorial" 的示例 "Video List Markup" 中,当我 select 一个项目 "itemSelected" 时,我想重写 "playVideo" 所以它正在创建一个 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 图片的屏幕?
roScreen
和其他 Roku SDK1 视觉组件通常与 SDK2(又名 RSG,"scene graph")组件不兼容。
所以不,您不能(或者您不尝试)在 RSG 模式下使用 roScreen。
但是您可以通过向场景添加一个 Poster 节点来做您想做的事。