Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bwaltersTCV
Level 7

Scene background URI won't update remote image

Jump to solution

Greetings all --

I am still learning quite a bit and I am sure this is a very simple question.

I am rebuilding our Roku channel to remove deprecated code and make some minor changes to the layout of the scene.  I want to be able to change the background image of our scene depending on time of year without resubmitting our channel to the testers.  

At the top of my scene in the first init I set the scene parameter m.top.backgroundURI = "http://myurl.com/myimage.jpg".  When I side load for testing on multiple Roku units the remote image comes up.  But when I change the image on my web server for testing purposes, it does not update on the side loaded app.  If I reboot my Roku and then side load again, it shows up.  

Have I done something incorrectly?  Is it because it is side loaded?

The image is publicly accessible from my server, so I know that is not the issue.  

Any thoughts or help is appreciated.

Below is a snippet of the code used in my brs file: (not the actual image url)

sub init()
  'To see print statements/debug info, telnet on port 8089
  m.top.backgroundColor = "0x676e80"
  m.top.backgroundUri = "http://myserver.com/roku/images/myimage.jpg"
0 Kudos
2 Solutions

Accepted Solutions
renojim
Community Streaming Expert

Re: Scene background URI won't update remote image

Jump to solution

Roku devices cache images.  It's probably documented somewhere, but I've never looked for it.  Try adding a "cache buster" to the end of your URI.  Something like

http://myserver.com/roku/images/myimage.jpg?cb=834768239

Change the number after cb to something random every time your channel starts.  Your server should ignore it.

There may be a documented way to handle it, but like I said, I've never looked for it.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.

View solution in original post

renojim
Community Streaming Expert

Re: Scene background URI won't update remote image

Jump to solution

You don't need to reference it to anything.  Just add any random string prefixed with "?cb=" ("cb" is also arbitrary) to the end of your URI and the server should ignore it, but the Roku will think it's a different image so it can't load it from its cache.  You can test the idea with curl:

curl -I http://myserver.com/image.jpg
curl -I http://myserver.com/image.jpg?cb=12345

They should produce the same output.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.

View solution in original post

0 Kudos
4 REPLIES 4\
renojim
Community Streaming Expert

Re: Scene background URI won't update remote image

Jump to solution

Roku devices cache images.  It's probably documented somewhere, but I've never looked for it.  Try adding a "cache buster" to the end of your URI.  Something like

http://myserver.com/roku/images/myimage.jpg?cb=834768239

Change the number after cb to something random every time your channel starts.  Your server should ignore it.

There may be a documented way to handle it, but like I said, I've never looked for it.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
bwaltersTCV
Level 7

Re: Scene background URI won't update remote image

Jump to solution

I didn't think it would cache that well, but it makes sense.

How would I implement the cache buster?  Obviously it is something I would have to include in the bright script, but do I need to reference it to anything?  

Any help is appreciated.

0 Kudos
renojim
Community Streaming Expert

Re: Scene background URI won't update remote image

Jump to solution

You don't need to reference it to anything.  Just add any random string prefixed with "?cb=" ("cb" is also arbitrary) to the end of your URI and the server should ignore it, but the Roku will think it's a different image so it can't load it from its cache.  You can test the idea with curl:

curl -I http://myserver.com/image.jpg
curl -I http://myserver.com/image.jpg?cb=12345

They should produce the same output.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
bwaltersTCV
Level 7

Re: Scene background URI won't update remote image

Jump to solution

That worked. 

 

I appreciate it very much.  Thanks

0 Kudos