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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to determine image is cached on OS?

Hi all

Am looking at the way Brightscript auto caches images and if it's possible to determine programmatically if the image being loaded into a Roku native list (via itemComponentName) is loading from the server or loading via the OS cache. 

Observing the `loadStatus` on the Poster fires the exact same results.

We're taking a look at this cause we're seeing inconsistent behaviour with an Animation fade up on loaded images into a RowList. Images loaded via the server fade up as expected. Images loaded from the cache fade up a lot faster, visually around 4 times faster.
If we force the images to load via the server each time, via a cache buster, the images fade up as expected.

Here's an example of the code we're using for the itemComponentName:

<?xml version="1.0" encoding="utf-8" ?>

<component name="RowListItem" extends="Group" >

  <script type="text/brightscript" uri="pkg:/components/view/RowListItem.brs" />

  <interface >
    <field id="itemContent" type="node" onChange="showContent"/>

    <Poster id="itemPoster" />
    <Animation id="fadeAnimation" duration="1.5" optional="true" repeat="false" easeFunction="linear" >
      <FloatFieldInterpolator id="fadeInterp" key="[ 0.0, 0.5, 1.0 ]"
          fieldToInterp="itemPoster.opacity" />


And the script:
sub init()"itemPoster").translation = [10, 10]
end sub

function posterLoadedStateHandler (status) as Void
  if (status.getData() = "ready")
  end if
end function

function fadeImageUp () as Void"itemPoster").opacity = 0"fadeInterp").keyValue = [0.0, 0.5, 1.0]"fadeAnimation").control = "START"
end function

sub showContent()
  if ( > 0 AND > 0)"itemPoster").observeField("loadStatus", "posterLoadedStateHandler")"itemPoster").uri ="itemPoster").width  ="itemPoster").height =
  end if
end sub
0 Kudos

Re: How to determine image is cached on OS?

Is the answer to this, No. There is no way with the current Roku OS to differentiate images loaded from the cache from images loading externally for the first time?
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.