I am working on a Roku Channel that has some live content that is only on for a limited part of the day. I’d like to have a poster image that looks one way when the live stream is not available and is not selectable but once the live stream is available I change the image and the user can select it. To do this I would need to have some way to regularly poll to detect if the stream is available or not and then change the image once it is. Any advice on how to accomplish this? I don’t see anything that would let me have a timer or polling loop. I’m also not sure if I can update an existing graphic.
Any pointers on other interface approaches that would be better would be appreciated also.
If you attach a timestamp to the end of the thumbnail file, then it’ll always pull down a new image instead of caching it.
If the stream becomes available at the same time every day, and unavailable at the same time every day, then you can get the system time from the roku, and have the channel do the conversion to the time zone you’re using (GMT for ease of use), and swap the image out that way without needing to poll the server - assuming that to have it recheck the user would exit the screen and reenter it again.
“jnicholas” wrote:
Any advice on how to accomplish this? I don’t see anything that would let me have a timer or polling loop.
Check out roTimespan in the Component Reference. You can also provide a non-zero argument to the Wait() call inside an event loop. The register example in the SDK uses the latter approach.
“jnicholas” wrote:
I’m also not sure if I can update an existing graphic.
Just change the item’s sdPosterURL and hdPosterURL and call the screen’s SetContentList() and Show() methods.
“destruk” wrote:
Or you could manually inject a poster item before parsing your xml file to add a “refresh list” so the user can select that to get current data…
What I’m trying to do is change the UI while a user is on a screen. While it would be easy to change the path to the image and the stream on the server side to reflect the availability of the show it makes for an awkward experience. Picture that you have loaded a channel and it says that there will be a live show at 7:00. You would find it annoying to have to go back to the previous screen and forward to the live screen again to get the updated image and feed from the new xml. It would be much friendlier to have the UI change to say “Now Showing” or “Live” or similar and then you just click. Even better would be for it to just start playing but I’m pretty sure there’s no way to trigger that automatically.
I have the live connection working great now, thanks for your help jbrave and rokuchris. I have noticed one odd thing though. The screen that is polling for live is a Springboard that has text indicating that live isn’t on right now but you can wait here for the live show to start. There is no action for the user to take except they can decide to hit up to go back to other content, but the screen won’t listen for the up event unless I add a button. I don’t really have anything for the button to do so is there a way to have it listen for the up button without adding a visible button? Or should I be using a different screen type here?
“jnicholas” wrote:
I have the live connection working great now, thanks for your help jbrave and rokuchris. I have noticed one odd thing though. The screen that is polling for live is a Springboard that has text indicating that live isn’t on right now but you can wait here for the live show to start. There is no action for the user to take except they can decide to hit up to go back to other content, but the screen won’t listen for the up event unless I add a button. I don’t really have anything for the button to do so is there a way to have it listen for the up button without adding a visible button? Or should I be using a different screen type here?
That’s a known issue. You must add at least one button. Usually I just add a button labeled “Back” that closes the screen if the user selects it.