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: 
360tv
Streaming Star

i broke my msg.isRemoteKeyPressed() and Canvas question

So I've been humming along quite nicely on adding features and fixing bugs in my channel. But I made some changes to my video player / image canvas. I've added some overlays that update automaticly within a specified interval. There are two things that I'd like to look into. Here's the block of my code that has my issues:



1) Once I Close() a canvas. Can I not show it again? Cause I've had to resort to shifting canvases on top of one another to hide one when I'm done with it, leaving it still open. Nor can I Clear() a canvas.

2) More importantly, msg.isRemoteKeyPressed() is not responding. It used to and it'd call a function that displayed another overlay and it worked perfectly. However with my recent changes I've done something to it to cause it to no longer respond. I've combed over my code several times and can't figure out what I did. The debug console acts as if it's not reciving anything. If my device.status <> "OK", then it kicks out and prints print "Remote button pressed: " + index.tostr(). The msg.isRemoteKeyPressed() block hasn't been changed since it's last worked and I can't tell what's wrong! Feedback please!
0 Kudos
2 REPLIES 2
destruk
Binge Watcher

Re: i broke my msg.isRemoteKeyPressed() and Canvas question

AFAIK Once a canvas is closed() there isn't a way to get it back without recreating it again. If it is closed, then you also lose any message port assignments you made to it.
If you do recreate it, you need to assign the message port to it again as it is considered a brand 'new' object.
It would probably be faster and more concise formatting for your code if you used swaplayers to keep the canvas open and use the same canvas to draw everything, or use multiple canvas objects all with the same message port.
0 Kudos
360tv
Streaming Star

Re: i broke my msg.isRemoteKeyPressed() and Canvas question

Copy that. I'll make the appropriate changes. However I'm still stuck on why it's not responding to msg.isRemoteKeyPressed().

Nermind. I needed to set a message port for the overlay canvas for it to respond.

(I removed my code because I realized there was a lot of stuff, urls and what not, I didn't want exposed.)
0 Kudos