Forum Discussion

btpoole's avatar
btpoole
Channel Surfer
11 years ago

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

5 Replies

  • destruk's avatar
    destruk
    Streaming Star
    I think you'd need to change to rovideoplayer to see the other buttons when triggered.
  • btpoole's avatar
    btpoole
    Channel Surfer
    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.
  • 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.
  • 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.
  • btpoole's avatar
    btpoole
    Channel Surfer
    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