Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SolveLLC
Level 8

Stop video playback while in loop

Anyone have any suggestions on how to stop playback on a video without sending "screen closed"? I want to stop a video and start a different video in the same loop.
0 Kudos
4 Replies
kbenson
Level 7

Re: Stop video playback while in loop

Hmm, can you keep the messageport separate, so you can implement the event loop outside of the video creation?

E.g.

mp = CreateObject("roMessagePort")
video = StartVideoFunc(options, mp)
while true
message = wait(1000,mp)
if NewVideoConditionMet()
video.close()
video = StartVideoFunc(newoptions, mp)
end if
end while


I imagine there might be a problem with the video object being reclaimed by the garbage collector before it's entirely finished closing (not sure if it blocks until complete), in which case you would want to assign it to a variable called oldvideo or something before reassigning it.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
TheEndless
Level 9

Re: Stop video playback while in loop

"SolveLLC" wrote:
Anyone have any suggestions on how to stop playback on a video without sending "screen closed"? I want to stop a video and start a different video in the same loop.

You can't, as far as I'm aware. Once the video completes, the screen closes. To accomplish what it sounds like you want, I put up a black image canvas (with a "Loading" or "Please Wait"), so the screen doesn't flash back to the UI, then start a new video screen.

You may also be interested in RokuChris's recent blog post that may do everything you actually need: http://blog.roku.com/developer/2011/06/ ... r-channel/

Side note, I sent you an email (two actually) awhile back regarding something along these lines, but never heard back. Did you get my email?
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
destruk
Level 10

Re: Stop video playback while in loop

If you use the custom video player example/roimagecanvas, then when the video is finished it gives a isfullresult message and the screen doesn't close. You can also use player.stop to stop the video at any time. Pause takes about 5 seconds to return to the event loop, and resume appears to be instant. I'm not sure what the cause of that delay is, but by merging code into the status notification and/or event loop you can have control on a per second basis without using a facade screen.
0 Kudos
TheEndless
Level 9

Re: Stop video playback while in loop

"destruk" wrote:
If you use the custom video player example/roimagecanvas, then when the video is finished it gives a isfullresult message and the screen doesn't close. You can also use player.stop to stop the video at any time. Pause takes about 5 seconds to return to the event loop, and resume appears to be instant. I'm not sure what the cause of that delay is, but by merging code into the status notification and/or event loop you can have control on a per second basis without using a facade screen.

With the major trade-off of having to code your own buffer screen, tracking bar, transport controls, etc. Not as much of an issue if it's a live stream, but it can be pretty tedious if you need the full functionality for VOD content.
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