Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
retrotom
Level 7

RoTuner API (Use outside of Scene Graph)

How does one use the roTuner API with ifVideoPlayer? I've tried to copy the way Content-Metadata is configured in the Scene Graph (SimpleTuner) example but I get a "failed to create media player" error every time. Are there any constraints when using Broadcast video vs streaming? I might have triggered this error by also using SetDestinationRect.

Any help would be greatly appreciated.
0 Kudos
15 Replies
Roku Employee
Roku Employee

Re: RoTuner API (Use outside of Scene Graph)

Looking into it...

- Joel
0 Kudos
retrotom
Level 7

Re: RoTuner API (Use outside of Scene Graph)

Smiley Very Happy Smiley Very Happy
0 Kudos
retrotom
Level 7

Re: RoTuner API (Use outside of Scene Graph)

Joel, the "GetNowNextPrograms" method on roProgramGuide also doesn't exist. I get a BrightScript error. I'm the latest TCL TV firmware (7.1).
0 Kudos
retrotom
Level 7

Re: RoTuner API (Use outside of Scene Graph)

Figured out the issue. I can literally just pass the content_metadata value from channel info to ifvideoplayer. Trying to create an AA that looks like the example doesn't work.
0 Kudos
artesea
Level 7

Re: RoTuner API (Use outside of Scene Graph)

"retrotom" wrote:
Figured out the issue. I can literally just pass the content_metadata value from channel info to ifvideoplayer. Trying to create an AA that looks like the example doesn't work.

Have you got an example of what you did? I was playing about with the roTuner stuff last week and could only get the Screne Graph stuff to work, and I've yet to dive down that path.
I want to guess that you've done something like this, but I'm away from the kit to test

tuner = CreateObject("roTuner")
if (tuner <> invalid)
channels = tuner.GetChannelList()
channelInfo = tuner.GetChannelInfo(channels[0])
if channelInfo <> invalid
port = CreateObject("roMessagePort")
canvas = CreateObject("roImageCanvas")
canvas.SetMessagePort(port)
canvas.SetLayer(0, { color: "#00000000", CompositionMode: "Source" })
canvas.Show()

player = CreateObject("roVideoPlayer")
player.SetMessagePort(port)
player.SetDestinationRect(canvas.GetCanvasRect())
player.SetContentList(channelInfo.content_metadata)
player.Play()
while true
msg = Wait(0, port)
if msg.isRemoteKeyPressed()
index = msg.GetIndex()
if index = 0 ' <BACK>
print "Closing video screen"
player.Stop()
exit while
end if
end if
end while
end if
end if
0 Kudos
retrotom
Level 7

Re: RoTuner API (Use outside of Scene Graph)

Your mistake is with this line (I think):


player.SetContentList(channelInfo.content_metadata)


It should be:


player.SetContentList([channelInfo.content_metadata])


To make it into an array.
0 Kudos
artesea
Level 7

Re: RoTuner API (Use outside of Scene Graph)

Thanks retrotom, remote testing appears to work, although I'm not actually in front of the TV to check.
Also wondering if GetNowNextPrograms is actually supported, or a typo is involved in the OS/docs.
0 Kudos
retrotom
Level 7

Re: RoTuner API (Use outside of Scene Graph)

I'm hoping it's just a typo. I've had to settle for just calling GetPrograms on each channel from the list. While it mostly works for my needs, I'm not confident this is the best route.
0 Kudos
EnTerr
Level 8

Re: RoTuner API (Use outside of Scene Graph)

"artesea" wrote:
Also wondering if GetNowNextPrograms is actually supported, or a typo is involved in the OS/docs.

Yes Smiley Happy. FWIW:
BrightScript Debugger> pg = createObject("roProgramGuide") : now = createObject("roDateTime")
BrightScript Debugger> ? pg.getNowNextPrograms("2.4", now)
<Component: roArray> =
[
   <Component: roAssociativeArray>
   <Component: roAssociativeArray>
]

Speaking of which... WTH is roContentMetadata ?!
BrightScript Debugger> ? pg.getNowNextPrograms("2.4", now)[0]
<Component: roAssociativeArray> =
{
   category:
   content_metadata: <Component: roContentMetadata>
   description:
   duration: <Component: roDateTime>
   format: <Component: roAssociativeArray>
   id:  330
   name: BUZZR Time Machine
   start_time: <Component: roDateTime>
}
0 Kudos