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: 
tutash
Binge Watcher

Images not loading consistently into PosterGrid

I'm using posterGrid and not markupGrid. This is a requirement of the code I'm writing. So, with that out of the way:

I create content nodes to populate a posterGrid, then set said grid's content to be that content node. This is normal stuff. For testing, I'm fetching the images from either a local server, or a CDN. 

Sometimes, when checking my server logs, I'll see a request for an image (for the posterGrid) twice, and this is when I'm seeing the error. The image doesn't load, and even though I've defined failedBitmapUri for the posterGrid, this image does not show, and isn't even called (nothing in the server logs). 

I see the same/similar behaviour when loading images from our CDN. 

Since I'm using posterGrid, I can't find a way to observe any loadStatus from the posterGrids contents.

Any idea what is happening here?
Why is the posterGrid functioning so poorly? 

Any insight into this problem would be greatly appreciated.
0 Kudos
5 REPLIES 5
joetesta
Roku Guru

Re: Images not loading consistently into PosterGrid

what are the file sizes of your images?
aspiring
0 Kudos
tutash
Binge Watcher

Re: Images not loading consistently into PosterGrid

File sizes are 6-7k. There are 16 of them.
0 Kudos
tutash
Binge Watcher

Re: Images not loading consistently into PosterGrid

I've found that if I run a routine like: 
sub prefetchImages(array as Object)
    print array.count()
    preloader = createObject("RoSGNode","Group")
    for i = 0 to array.count()-1
        if type(array[i]) = "roString" then
            image = createObject("RoSGNode","Poster")
            image.uri = array[i]
            preloader.appendChild(image)
            print array[i]
        end if
    end for
    print "PREFETCH SET"
    m.scene.content = m.content
    print "CONTENT SET"
    for i = 0 to array.count()-1
        item = preloader.getChild(i)
        item = invalid
        preloader.removeChild(i)
    end for
    preloader = invalid
    print "PREFETCH REMOVED"
end sub

After a routine like this, the images will load when the content node is applied to PosterGrids. This doesn't remove the subsequent requests to the server from the now populated posterGrid, but it does mean that they don't fail to load. I'm not sure why this works, but it does.
0 Kudos
Veeta
Visitor

Re: Images not loading consistently into PosterGrid

Tutash, what other requests may be happening at the same time the postergrid is loading? I've found failures when i load up too many visible items at once and it seems to hit a threshold for simultaneous network requests.
0 Kudos
tutash
Binge Watcher

Re: Images not loading consistently into PosterGrid

Veeta,

I'm getting that feeling as well. I'll try staggering the population of renderable objects over time to see if I can improve loading performance.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.