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

Register to player events and showing videos

Hey. 2 un-related question.

#1: How do I get events when the player loaded, play, pause, seeked and so on?
I understand i need to register a port object to a roVideoPlayer and wait on a loop for event messages, but I must be doing something wrong.
Need some info how to do it and when/where in the app life cycle.

#2: your support until now was amazing so I am now able to fully communicate with our server. and get the videos info.
How, and when, do I add them to a list of of items I have on screen?

Thanks a lot,
Dan

EDIT for issue #2: I now have a a task xml file that does all the communication work, and passes the data in a callback to the VideoGridScene.
But still, how do I add them to a list of of items I have on screen?
(#1 is still a question.)
0 Kudos
1 REPLY 1
belltown
Roku Guru

Re: Register to player events and showing videos

If you're using Scene Graph you won't be using roVideoPlayer, you'll be using a Video component.

Set up a field observer for any of the Video node fields you wish to observe, e.g:

in init():


m.videoNode = m.top.findNode("myVideoNode")
m.videoNode.ObserveField("state", "onState")


define your observer function:


sub onState()
    print "Video state: "; m.videoNode.state
end sub


There are other fields you may want to observe as well: errorCode, errorMsg, bufferingStatus, etc., etc.
0 Kudos