Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bosborne
Visitor

Re: Beta Scene Graph Components

"jul10" wrote:
"maria_tarkany" wrote:
How to set a field outside the xml file?

I want to send a value when I create a scene in main function:
sub Main()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("FirstScene")
scene.url = "http://wallpaperswide.com/download/" 'HERE I want to send the url value
'in debugging mode scene.url or scene.top.url are both invalid here
screen.show()
end sub


I have this xml with "FirstScene" Scene:
<?xml version="1.0" encoding="utf-8" ?> 
<component name="FirstScene" extends="Scene" >
<interface>
<field id="url" type="string"/>
</interface>
<script type="text/brightscript">
<![CDATA[
sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.uri = m.top.url 'HERE I want to use the url
'But when I debug the app, in terminal the m.top.url field has no value
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"
end sub
]]>
</script>
</component>


In order to make this work you'll need to have an observer set up on the 'url' field in your scene.

So your init() in your FirstScene would look like this:


sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"

m.top.observeField("url", "onUrlChanged")
end sub

sub onUrlChanged()
m.ep1.uri = m.top.url
end sub


The rest should remain unchanged.


I'm unable to get this working as well.

Here's a simple example. I want to pass in an roAssociativeArray of categories into the scene (and into the row list). Here's the code for my scene... "hello" is never even printed.

<?xml version="1.0" encoding="utf-8" ?> 

<component name="SimpleRowListScene" extends="Scene" >

<interface>
<field id="categories" type="assocarray" onChange="categoriesChanged"/>
</interface>

<script type="text/brightscript" >
<![CDATA[
function init()
print "in init"
m.theRowList = m.top.FindNode("theRowList")
m.theRowList.SetFocus(true)
end function

function categoriesChanged() as void
print "hello"
m.top.theRowList.categories = m.top.categories
end function
]]>
</script>

<children>
<SimpleRowList id="theRowList" translation="[50,50]" />
</children>
</component>


My brightscript main code:


categories = getCategoryAssociateArrayData()

screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("SimpleRowListScene")
scene.categories = categories
screen.show()

while(true)
msg = wait(0, port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed()
return true
end if
end if
end while
0 Kudos
bosborne
Visitor

Re: Beta Scene Graph Components

I am also curious how one would secure video with the new video component? A couple other users asked this as well but it hasn't been answered yet.

It would also be great to get a basic "full app" tutorial up that uses multiple scenes together as another user suggested
0 Kudos
helloworld__
Visitor

Re: Beta Scene Graph Components

Will RightToLeft (RTL) text direction be supported in rendered nodes that have a text field? -- The roImageCanvas does a good job of it. -- Currently if you set the Label's text field to an RTL string, the characters are shown in the wrong order and disjointed.

The SDK document says that the Label node supports Justification, but setting it in horizAlign doesn't work?

Any possibility of given all Scene Graph nodes that show text, including the widgets, the ability to set their own font, text direction, justification (in cases where it makes sense), character Kerning, character spacing, and to get the justification character?

For ref: https://msdn.microsoft.com/en-us/library/windows/desktop/hh994452(v=vs.85).aspx


Any possibility of given the ability to change the default font for an entire Scene? and an entire node (including its children)? and for a specific node (even when it's a child)?
0 Kudos
jul10
Visitor

Re: Beta Scene Graph Components

"bosborne" wrote:
"jul10" wrote:


In order to make this work you'll need to have an observer set up on the 'url' field in your scene.

So your init() in your FirstScene would look like this:


sub init()
m.ep1 = m.top.createChild("Poster")
m.ep1.width = "264"
m.ep1.height = "148"
m.ep1.translation = "[930,500]"

m.top.observeField("url", "onUrlChanged")
end sub

sub onUrlChanged()
m.ep1.uri = m.top.url
end sub


The rest should remain unchanged.


I'm unable to get this working as well.

Here's a simple example. I want to pass in an roAssociativeArray of categories into the scene (and into the row list). Here's the code for my scene... "hello" is never even printed.

<?xml version="1.0" encoding="utf-8" ?> 

<component name="SimpleRowListScene" extends="Scene" >

<interface>
<field id="categories" type="assocarray" onChange="categoriesChanged"/>
</interface>

<script type="text/brightscript" >
<![CDATA[
function init()
print "in init"
m.theRowList = m.top.FindNode("theRowList")
m.theRowList.SetFocus(true)
end function

function categoriesChanged() as void
print "hello"
m.top.theRowList.categories = m.top.categories
end function
]]>
</script>

<children>
<SimpleRowList id="theRowList" translation="[50,50]" />
</children>
</component>


My brightscript main code:


categories = getCategoryAssociateArrayData()

screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("SimpleRowListScene")
scene.categories = categories
screen.show()

while(true)
msg = wait(0, port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed()
return true
end if
end if
end while


Forgot to mention this in my first reply, but you also need to assign the scene variables after calling screen.show().
So, in your case:


categories = getCategoryAssociateArrayData()

screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("SimpleRowListScene")
screen.show()
scene.categories = categories

while(true)
msg = wait(0, port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed()
return true
end if
end if
end while


This should work.
0 Kudos
bosborne
Visitor

Re: Beta Scene Graph Components

I tried that yesterday as well, after I stumbled upon something in the docs that mentioned that. But it still did not trigger my field observer in the component.
0 Kudos
TheEndless
Channel Surfer

Re: Beta Scene Graph Components

"bosborne" wrote:
Here's a simple example. I want to pass in an roAssociativeArray of categories into the scene (and into the row list). Here's the code for my scene... "hello" is never even printed.

<?xml version="1.0" encoding="utf-8" ?> 

<component name="SimpleRowListScene" extends="Scene" >

<interface>
<field id="categories" type="assocarray" onChange="categoriesChanged"/>
</interface>

<script type="text/brightscript" >
<![CDATA[
function init()
print "in init"
m.theRowList = m.top.FindNode("theRowList")
m.theRowList.SetFocus(true)
end function

function categoriesChanged() as void
print "hello"
m.top.theRowList.categories = m.top.categories
end function
]]>
</script>

<children>
<SimpleRowList id="theRowList" translation="[50,50]" />
</children>
</component>

I don't know if this is the cause of your problem (probably not, if you're not seeing the "hello"), but "m.top.theRowList.categories = m.top.categories" should be "m.theRowList.categories = m.top.categories".
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Beta Scene Graph Components

How do I add subtitles in a scene graph Video Node ? I have tried setting the subtitleTrack field and also the fields in the meta data but with no luck . For a hls video what should i set to this subtitleTrack or in the meta-data fields? There's nothing in the documentation for the video node and the subtitle .
0 Kudos
sudo97
Visitor

Re: Beta Scene Graph Components

What about using two Video nodes on one scene? You have written it's impossible to switch between two scenes, so I created two Group nodes and each of them contains imitation of scene, and both have Video node, so that causes strange behaviour.
0 Kudos
RokuRobB
Streaming Star

Re: Beta Scene Graph Components

Closed caption integration in scene graph is similar to the legacy SDK. You set up the subtitleconfig content attribute as shown in the SceneGraphCaptionsDemo.zip sample found here: http://sdkdocs.roku.com/display/sdkdoc/Playing+Videos.
0 Kudos
RokuRobB
Streaming Star

Re: Beta Scene Graph Components

Using two video nodes to stream at the same time is not supported. This is similar to the fact that only one roVideoScreen or roVideoPlayer can stream content at a time.
0 Kudos