ioan ghip
ioan ghip

Reputation: 1222

I need help modifying one of the examples to start a roScreen

In the example "Video List Markup" from the "Scene Graph XML Tutorial", when I select an item "itemSelected", I want to rewrite "playVideo" so it's creating a roScreen so I can draw my own images on it. Is it possible?

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

If it's not possible, how can I replace the video playing screen with a screen that allows me to draw my own jpg images on it?

Upvotes: 1

Views: 325

Answers (1)

Nas Banov
Nas Banov

Reputation: 29020

roScreen and the other Roku SDK1 visual components as a rule are immiscible with the SDK2 (aka RSG, "scene graph") components.

So no, you can't (or don't you try) use roScreen when in RSG mode.

But you can do what you want by say adding a Poster node to the scene.

Upvotes: 1

Related Questions