Forum Discussion

SolveLLC's avatar
SolveLLC
Visitor
15 years ago

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.

4 Replies

  • 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.
  • "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?
  • destruk's avatar
    destruk
    Streaming Star
    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.
  • "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.