Roku Direct Publisher

The easiest way to create a great TV experience.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
nram
Level 8

How to display an image between videos

I am using RAF to play ads and a list of content

At the end of each video and before the next video starts, I would like to display an image for 5 seconds 

At the end of 5 seconds or if the user clicks any button on the remote, the next video in the list should start playing.

The video is played using a task - PlayerTask.brs

The code is as shown below

m.RAF = Roku_Ads() 'This line was moved up here by NR
m.RAF.enableAdMeasurements(true) 'This line was moved up here by NR

m.RAF.setTrackingCallback(rafCallbackFunc, m.localArray) 'it was m.playerTask earlier...
m.RAF.SetAdUrl(m.adurl)
keepPlay = true

maxrowindex = m.top.allContent.getChildCount() - 1
currentrowindex = m.top.selectedRowIndex
currentcolindex = m.top.startIndex
rowloop = true
colloop = true
while rowloop and keepPlay 'row loop
      content = m.top.allContent.getChild(currentrowindex) 'The list of all content videos
      items = []
      if content.getChildCount() > 0
          items = content.getChildren(-1, 0)
      else
          items = [content]
      end if

      maxcolindex = items.Count()
      while colloop and keepPlay 'column loop
          parentNode.SetFocus(true)
          item = items[currentcolindex]
          m.RAF.SetContentId(item.id)
          if item.categories <> invalid
              m.RAF.SetContentGenre(item.categories)
          end if
          m.RAF.SetContentLength(int(item.length)) ' in seconds
           adPods = m.RAF.GetAds() ' ads retrieving
           'save the indices
          m.top.lastIndex = currentcolindex
          m.top.lastRowIndex = currentrowindex

          ' combine video and ads into a single playlist
          csasStream = m.RAF.constructStitchedStream(item, adPods)
          ' render the stitched stream
          keepPlay = m.RAF.renderStitchedStream(csasStream, parentNode)

          if keepPlay
              'HERE I WOULD LIKE TO SHOW AN IMAGE FOR 5 SECONDS

              currentcolindex++
              if currentcolindex = maxcolindex
                  colloop = false
              end if
          end if
      end while

      if keepPlay
          currentrowindex++
          if currentrowindex > maxrowindex

              currentrowindex = 1
              currentcolindex = 0
              colloop = true
          else
              currentcolindex = 0
              colloop = true
          end if
      end if
end while

 

0 Kudos