Forum Discussion

WilDD's avatar
WilDD
Roku Guru
9 years ago

Simple roVideoPlayer Code Crashes When Packaged

The following roVideoPlayer code runs "forever" when ran in side-loaded developer mode, but crashes when packaged and ran as a private channel.

Sub RunUserInterface()
    port=CreateObject("roMessagePort")
    canvas=CreateObject("roImageCanvas")
    player=CreateObject("roVideoPlayer")
    player.SetMessagePort(port)
    player.SetLoop(true)
    player.SetContentList([{
        Stream: { url: "http://wilddtech.com/public/video.mp4" }
        StreamFormat: "mp4"
    }])
    canvas.SetMessagePort(port)
    canvas.SetLayer(0, { Color: "#00000000" })
    canvas.Show()
    player.Play()
    eventLoop(port)
End Sub

Sub EventLoop(port)
    while true
        msg = wait(0, port)
    end while
End Sub


The video is only a 2 second video, but my attempt is to simulate a signage application that loops a video constantly 24 hours a day. I wanted to see if the number of looping repetitions causes problems without having to wait for it to run for days or weeks to see the result. So the 2 second video represents a longer running video that might run looping constantly for several days.

This code runs for a very long time in developer mode (I stop it after about 12 hours), but crashes after 2 hours and 10 minutes when packaged and ran as a private channel. It doesn't cause a reboot, it just stops and exits to the Roku home screen.

Does anyone know why this would happen? And more importantly, is there a way to prevent it from happening?

I have tested this on the following configurations with the same results:

Roku 2 XS Version 7.2.0 Build 4100-02
Roku 4 Version 7.2.0 Build 4100-17

4 Replies

  • That sounds like the new "feature" that Roku implemented recently to prevent the device from doing what you described -- running for more than a few hours at a time before returning to the Home Screen:
    https://forums.roku.com/viewtopic.php?f=28&t=94604

    It shouldn't happen if you're playing a single video continuously, but I imagine it might if you're looping the same video repeatedly. A possible workaround is for your channel to send ECP key press commands to itself at regular intervals to prevent screensaver activation/returning to the Home screen.
  • Thanks for the info belltown. I'll try the ECP workaround and report back with the results.
  • The UpdateLastKeyPressTime() fixed the problem.

    Thanks belltown and RokuKC for your help.