jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2010
04:17 PM
waiting for messages
Now that I've learned how to retrieve xml and parse it for url's to play, how to enque the urls into an roAudioPlayer, and start it playing, I'm trying to learn how to do button detection so I can pause, skip, exit, etc. I've slightly modified this code snippet from the RokuDVP Component Reference to print out messages, but all it prints are the messages coming from the roAudioPlayer, not button presses on the remote. What am I missing?
while true
msg = wait(0, port)
?type(msg)
?"message is: ";msg.getmessage()
if type(msg) = "roAudioPlayerEvent"
if msg.isStatusMessage() then
print "roAudioPlayerEvent: "; msg.getmessage()
if msg.getmessage() = "end of playlist" return
endif
endif
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2010
04:42 PM
Re: waiting for messages
Did you call SetMessagePort(port) on the screen you're currently displaying? If not, you won't capture any messages for it.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2010
05:05 PM
Re: waiting for messages
I'm not displaying a screen, everything is just back-end: get xml, parse, load list of url's into player, and call audioplayer.play
Do I need to have a screen up to listen for button press messages? I figured I would learn the back end and build the "meat" of my app before tackling the visual side of it...
- Joel
Do I need to have a screen up to listen for button press messages? I figured I would learn the back end and build the "meat" of my app before tackling the visual side of it...
- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2010
05:14 PM
Re: waiting for messages
Thanks for responding - Ah I see, I need to tell some component (presumably one that handles the remote buttons) to send messages to the port I'm using, not just the audio player. So I have audioplayer.setmessage(port) but I need to do that for whatever component I'm listening for.
- Joel
- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2010
05:32 PM
Re: waiting for messages
"jbrave" wrote:
Thanks for responding - Ah I see, I need to tell some component (presumably one that handles the remote buttons) to send messages to the port I'm using, not just the audio player. So I have audioplayer.setmessage(port) but I need to do that for whatever component I'm listening for.
- Joel
Right. As far as I'm aware, only screens can receive button presses, so you'll need to display some screen to do what you're trying. Make sure you assign both the screen and the audioplayer the same port, otherwise you'll only receive messages for one of the other (depending on your Wait statement).
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2010
02:26 PM
Re: waiting for messages
Yes, TheEndless is correct that you need to call SetMessagePort on a screen that propagate remote buttons. Some screens catch the buttons and process them internally (for example the roVideoScreen will pause the video when you click pause and not propagate the isRemoteKeyPressed() event to the message port.
--Kevin
--Kevin