WilDD
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2016
02:23 PM
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.
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
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 4
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2016
07:20 PM
Re: Simple roVideoPlayer Code Crashes When Packaged
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.
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.
WilDD
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2016
07:49 PM
Re: Simple roVideoPlayer Code Crashes When Packaged
Thanks for the info belltown. I'll try the ECP workaround and report back with the results.


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2016
11:50 AM
Re: Simple roVideoPlayer Code Crashes When Packaged
"WilDD" wrote:
Thanks for the info belltown. I'll try the ECP workaround and report back with the results.
Having an app use ECP to send keypress events to itself is not a recommended technique, and does not work in all environments.
See roAppManager UpdateLastKeyPressTime() instead.
https://sdkdocs.roku.com/display/sdkdoc/ifAppManager#ifAppManager-UpdateLastKeyPressTime()asVoid
WilDD
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2016
04:32 AM
Re: Simple roVideoPlayer Code Crashes When Packaged
The UpdateLastKeyPressTime() fixed the problem.
Thanks belltown and RokuKC for your help.
Thanks belltown and RokuKC for your help.