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: 
edskitter
Visitor

Re: Beta Scene Graph Components

Does anyone have an example of the epggrid? It would be great to see the performance and what is offered...
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

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

<!--********** Copyright 2015 Roku Corp. All Rights Reserved. **********-->

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

<script type="text/brightscript" >

</script>

<children>
<!-- EPG Grid -->
<customEPGGrid />
</children>
</component>


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

<component name="customEPGGrid" extends="EPGGrid" >

<script type="text/brightscript" >

<![CDATA[

function init()
print "inside epg"
m.content = createObject("RoSGNode","ContentNode")
m.top.setFocus(true)

dateNow = CreateObject("roDateTime")
dateNow = dateNow.asSeconds() - 2000

addChannel("ABC")
addItem("ABC Show ", dateNow)


addChannel("CBS")
addItem("CBS Show ", dateNow)

addChannel("NBC")
addItem("NBC Show ", dateNow)


addChannel("NICK")
addItem("NICK Show ", dateNow)

addChannel("OUTSIDE")
addItem("Outside Show ", dateNow)

addChannel("TEST")
addItem("Test Show ", dateNow)

m.top.content = m.content
m.top.translation = [50, 300]
m.top.numRows = 5
m.top.duration = 10800
m.top.nowNextMode = false
m.top.infoGridGap = 0
m.top.channelInfoColumnLabel = "Hello"

end function

sub addChannel(channelText as string)
m.channel = m.content.createChild("ContentNode")
m.channel.TITLE = channelText
m.channel.HDSMALLICONURL = "http://css.boshanka.co.uk/wp-content/uploads/2015/04/icon-logo-design-small.png"
end sub

sub addItem(progText as string, timeStart)
For i=0 To 5 Step 1
program = m.channel.createChild("ContentNode")
program.TITLE = progText + str(i)
program.PLAYSTART = timeStart + (i * 2000)
program.PLAYDURATION = "2000"
End For

end sub

]]>

</script>
</component>


main.brs
'********** Copyright 2015 Roku Corp.  All Rights Reserved. **********

sub Main()
showChannelSGScreen()
end sub

sub showChannelSGScreen()
print "in showChannelSGScreen"
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("epgGridScene")
screen.show()

while(true)

msg = wait(0, m.port)
msgType = type(msg)

if msgType = "roSGScreenEvent"

if msg.isScreenClosed()
print "screen closed"
return
end if

end if

end while
end sub


I can get the EPG to render but I can not get the grid to have focus to move up / down / left / right. What am I missing?
0 Kudos
TheEndless
Channel Surfer

Re: Beta Scene Graph Components

"edskitter" wrote:
I can get the EPG to render but I can not get the grid to have focus to move up / down / left / right. What am I missing?

Try giving your customEPGGrid tag an id and setting the "initialFocus" attribute of the epgGridScene component. Or set focus to the grid explicitly inside the init function (which currently doesn't exist) in your epgGridScene.xml.
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
sudo97
Visitor

Re: Beta Scene Graph Components

What about creating one scene from another? I need to edit settings in my application. Or can I just use Dialogs?
here's code I wrote to create a simple dialog, and nothing appears, when I press button:

function onKeyEvent(key as string, press as boolean) as boolean
handled = false
if (press)
if(key = "options")
m.dialog = CreateObject("roSGNode", "Dialog")
m.dialog.title = "HELLO WORLD"
m.dialog.message = "SIMPLE DIALOG"
handled = true
end if
end if
return handled
end function


I use roku stick, what am I doing wrong?


SOLVED, just had to write m.top.dialog instead of m.dialog
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

Thanks Endless but I had tried both. Strange, I used this :

m.top.jumpToItem = 0
m.top.animateToItem = 1


inside the customEPGGrid component and I am able to scroll now. I am really not sure why that kicked it off. I kept the m.top.setFocus(true) inside the component as before.
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

Concerning video, what are Roku's plan for securing video?

In previous version, I was using :

videoContent.Addheader("reserved-id", "xxxx.."
videoContent.SetCertificatesFile("pkg:/certs/xx.crt")
videoContent.InitClientCertificates()

How can we achieve this with the new API?
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

How would keep persistent data ( i.e. login information ) as roRegistry is not allowed in the Graph components?
0 Kudos
vjani
Visitor

Re: Beta Scene Graph Components

Hello,

I am going through the Scene Graph documentation to figure out whether we can use that for our channel or not. Since the Video roSGNode replaces roVideoPlayer/roVideoScreen, how do I listen for the various events that those components used to throw, such as isStreamStarted/isPlaybackPosition etc? There are no "ObserveOnly" Event fields in the Video documentation, which I can observe using observeField. Is there any example for videoplayer with progressbar that I can refer using the Scene Graph framework?

Thanks,
Vivek
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

Hello Vivek,

You can use the observeField like this :

m.video.ObserveField("state","hlsStatus")
m.video.ObserveField("bufferingStatus", "hlsLoading")

function hlsStatus() as void
print m.video.state
end function

function hlsLoading() as void
loading = m.video.bufferingStatus
print "========="
print "hlsLoading"
print loading.percentage
print loading.isUnderrun
print "========="
'end function


I did receive an error when the hlsLoading function reached 100% though.
0 Kudos
edskitter
Visitor

Re: Beta Scene Graph Components

Could Roku post an example with multiple scenes and how to navigate between them? That would be a great start to learning how to use the Scene Graph components. The examples posted seem to show a main.brs with 1 scene creation.

For example, multiples scenes involving :
Marketing scene
Login scene
Video scene
Channel Navigation (EPGGrid) scene

It would cool to see how best to architect this with the new Scene graph components.

When will this go live from Beta?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.