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

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 4
belltown
Roku Guru

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.
0 Kudos
norcaljohnny
Roku Guru

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
destruk
Streaming Star

Re: Roku Autoplay Video Function

This thread is from 2016...
0 Kudos
norcaljohnny
Roku Guru

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
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.