Your Digital Media Has Never Looked So Good

 
jaxim
Topic Author
Posts: 65
Joined: Mon Sep 26, 2016 6:25 am

Lazy Loading of Rowlist items

Thu Aug 02, 2018 8:23 am

Is there a way to lazy load thumbnail images when they get into view? Is there a way to unload these same images once they get out of view?

There is mention of lazy loading on the following page, but I am unsure what needs to be done in order to accomplish this feature. Is this just for GridView or can RowList use lazyLoading? 

https://sdkdocs.roku.com/display/sdkdoc ... s-GridView
 
jaxim
Topic Author
Posts: 65
Joined: Mon Sep 26, 2016 6:25 am

Re: Lazy Loading of Rowlist items

Thu Sep 20, 2018 8:52 am

UPDATE: I have not found a way to lazy load an item in a RowList yet. Has anyone figured out how to do this?

Also, let me define what I mean by lazy loading in case others define it differently.
Lazy Loading = loading a thumbnail image only when it is visible to the user. So as I scroll the rowlist to the right, each of the images of the thumbnails that were not visible should load once they become visible.
 
BVatBBOD
Posts: 13
Joined: Wed Mar 29, 2017 9:54 am

Re: Lazy Loading of Rowlist items

Sat Sep 29, 2018 5:19 pm

I do this in my app.

I simply start the grid with a ContentNode with a few (~30) sub ContentNode's.  On each item focus, I check to see how far they are down the list.  When they get (say 75%) down the list I trigger a task that then fetches the next 30 items.  As soon as the task returns them, I append those as ContentNode's to the grid's ContentNode.  I don't really worry about "unloading" the images as I believe Roku will handle unloading images as they go out of view (and in my experience it will).

Let me know if any of that is unclear. Also hit me up on Roku Dev Slack for more realtime discussion. (link in my sig)
Join the Roku Developers Slack Workspace for quicker help and great dev collaboration: http://tiny.cc/nrdf0y
 
jaxim
Topic Author
Posts: 65
Joined: Mon Sep 26, 2016 6:25 am

Re: Lazy Loading of Rowlist items

Tue Oct 02, 2018 9:24 am

BVatBBOD, I will try that. I was hoping there would be an event to which the item could listen to know if it were visible, but I guess I will need to  do this outside of the RowList and hardcode that the fact that only 5 thumbnails (in my case) can be seen at any one time.

Thanks for the tip on the Slack channel, I'll be sure to subscribe! 

Who is online

Users browsing this forum: No registered users and 2 guests