Forum Discussion

rontom974's avatar
rontom974
Visitor
9 years ago

Roku Autoplay Video Function

Hi, i have a roku application
i need some help adding autoplay video function
once the video completes it need to select the next video and play automatically after showing 
a message like "your next video will be resume in 5 seconds."
how can i do that ?

4 Replies

  • You need to set up an on video state function for instance:


    If (m.video.state = "playing")
     if m.video.duration = m.video.duration - 5 then
       m.yourCustomLabel.text = "Your video will resume in 5 seconds"
     end if
    end if

    If (m.video.state = "finished")
      m.video.control = "stop"
      m.videocontent = m.yourVideoList.content.getChild(1)
      m.video.content = m.videocontent
     m.yourCustomLabel.text = ""
     m.video.control = "play"
    end if
  • For a general idea of how to do that, take a look at https://github.com/belltown/Roku-NewVideoPlayer/blob/master/source/UI.brs, specifically the uiDisplayVideoDetails function starting on line 300, and the uiPlayVideo function that starts on line 420. The code implements Play/Resume, Play from beginning, and Play all for a list of videos. If you can generally understand what the code is doing then you should have no trouble implementing your own solution.
  • "destruk" wrote:
    This thread is from 2016...

    Yes true but it seems a lot of people still have trouble with this...?