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: 
btpoole
Level 7

Detect Remote Button During VideoScreenEvent

Looking for some suggestions or help for the following. Currently have a channel that plays video thru roVideoScreen. Everything works as planned with the following exception. After the video starts part of the code is a while true that waits for a port message, if the message is roVideoScreenEvent it checks if a remote button was pressed, if so it prints the button index, if not it ignores this part. During video play I can press the pause, resume, rewind etc and they work but the index never appears in the debug. I am wishing to assign a value to one of the less used buttons to have an event occur if the that button is pressed during play. Any help greatly appreciated.


lastSavedPos = 0
statusInterval = 10 'position must change by more than this number of seconds before saving
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event
exit while
elseif msg.isRemotePressed()
print "button pressed: ";msg.GetIndex()
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
PRINT msg.GetIndex()
if nowpos > 10000
end if
if nowpos > 0
if abs(nowpos - lastSavedPos) > statusInterval
lastSavedPos = nowpos
end if
end if
end if
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
end if
end while
0 Kudos
5 Replies
destruk
Level 10

Re: Detect Remote Button During VideoScreenEvent

I think you'd need to change to rovideoplayer to see the other buttons when triggered.
0 Kudos
btpoole
Level 7

Re: Detect Remote Button During VideoScreenEvent

Thanks but I really don't want to work with the roVideoPlayer, seesm to be much harder to code for, maybe just me. I have the VideoScreen working great for what I want but I want to assign some events to the remote but have been unable at this point. Any help on that greatly appreciated.
0 Kudos
Roku Employee
Roku Employee

Re: Detect Remote Button During VideoScreenEvent

You cannot directly detect button presses from roVideoScreen. Depending on which buttons you're interested in, you might be able to do this indirectly with events like isPaused, isResumed, etc.
0 Kudos
TheEndless
Level 7

Re: Detect Remote Button During VideoScreenEvent

In general, any buttons used by a component internally are not exposed to BrightScript. In the case of roVideoScreen, every button on the remote is used by the component, so nothing will bubble up to your BrightScript code. You are correct that roVideoPlayer is a lot more work to implement (particularly if you want to support trickplay), but that's likely the only way you'll be able to accomplish what you're after.
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
btpoole
Level 7

Re: Detect Remote Button During VideoScreenEvent

Thank you all for the advice. I have bitten the bullet and dove into rovideoplayer. Currently using the customerplayer provided in sdk and have managed to follow the progression enough to incorporate it in to my idea so far, but not done so still trial and error.
Thanks again
0 Kudos