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: 
PositivePeak
Visitor

Looping Video

Hi all-

Pardon my newness, but is there a simple script that will launch a video from the first click (no categories - right into video) and loop it over and over until the user hits the back key? I would be willing to pay someone for a simple brs file.

Thanks- I hope all is having a great weekend.

Dave
0 Kudos
6 REPLIES 6
TheEndless
Channel Surfer

Re: Looping Video

The simplevideoplayer example in the SDK does pretty much exactly that.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
PositivePeak
Visitor

Re: Looping Video

Awesome - thanks for that. Is there an easy way to make it full screen?
0 Kudos
TheEndless
Channel Surfer

Re: Looping Video

The simplevideoplayer should be full screen. Are you sure you're looking at it and not the customvideoplayer example?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
PositivePeak
Visitor

Re: Looping Video

You are right - I was looking at the custom vid example. Thank you. This example looks more toward our needs, however, when you launch this channel- it first goes to a 'play' poster... then, after instructed to play, it will fire off a video. After the video it returns to the poster. My question for you is, how can I get it to restart the same video when it finishes playing and also get it to play as soon as you enter the channel?
0 Kudos
TheEndless
Channel Surfer

Re: Looping Video

Here you go... give this a try. All you should need to do is change the videoContent information to match yours:

Sub RunUserInterface()
'Draw black canvas to prevent screen flickering between loops
blackCanvas = CreateObject( "roImageCanvas" )
blackCanvas.SetLayer( 0, { Color: "#000000", TargetRect: { x: 0, y: 0, w: 1280, h: 720 } } )
blackCanvas.Show()

' Set up video content
videoContent = {
Title: "My Video",
Stream: { url: "http://url.to.my.video" },
StreamFormat: "mp4"
}

' Create MessagePort for capturing events
msgPort = CreateObject( "roMessagePort" )

StartVideo:
' create video screen and set the message port
video = CreateObject( "roVideoScreen" )
video.SetMessagePort( msgPort)

' Set the content, and show the video
video.SetContent( videoContent )
video.Show()

While True
msg = Wait( 0, video.GetMessagePort() )
If Type( msg ) = "roVideoScreenEvent" Then
If msg.IsFullResult() Then
' Full Result indicates that the video completed,
' So create a new video screen and start again
GoTo StartVideo
Else If msg.IsPartialResult() Then
' A partial result indicates that the video was
' cancelled, probably by pressing up on the remote
' so exit the app
Exit While
End If
End If
End While
End Sub


I got your email, btw, but haven't really had a chance to take a look, yet.

DISCLAIMER: I wrote this in notepad and didn't test it, so there may be a syntax error or two... 😉
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
PositivePeak
Visitor

Re: Looping Video

You are awesome! Works great!!!!! Thank you!
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.