Your Digital Media Has Never Looked So Good

Topic Author
Posts: 18
Joined: Thu Feb 02, 2017 8:11 am

How to determine image is cached on OS?

Mon Dec 04, 2017 3:34 am

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
Topic Author
Posts: 18
Joined: Thu Feb 02, 2017 8:11 am

Re: How to determine image is cached on OS?

Fri Dec 08, 2017 2:32 am

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?

Who is online

Users browsing this forum: norcaljohnny and 2 guests