Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
rontom974
Level 7

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 ?
0 Kudos
4 Replies
belltown
Level 7

Re: Roku Autoplay Video Function

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.
https://github.com/belltown/
0 Kudos
norcaljohnny
Level 7

Re: Roku Autoplay Video Function

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
0 Kudos
destruk
Level 10

Re: Roku Autoplay Video Function

This thread is from 2016...
0 Kudos
norcaljohnny
Level 7

Re: Roku Autoplay Video Function

"destruk" wrote:
This thread is from 2016...

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