bosborne
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2012
10:22 AM
Check if screen has been closed?
I'm wondering if it's possible to detect if a screen has been closed?
In one function, it's possible that a screen I'm working with would have been closed. Once that method exits, additional code runs that may need to execute a different path depending on if that screen was closed or not. In this case, I can't simply go by the return value of that first method.
I tried checking that object to see if it is = invalid, but that doesn't work.
Any ideas? Thanks
In one function, it's possible that a screen I'm working with would have been closed. Once that method exits, additional code runs that may need to execute a different path depending on if that screen was closed or not. In this case, I can't simply go by the return value of that first method.
I tried checking that object to see if it is = invalid, but that doesn't work.
Any ideas? Thanks
6 REPLIES 6

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2012
12:54 PM
Re: Check if screen has been closed?
You need to check for the msg.isScreenClosed() event:
while true
msg=wait(0,port)
if lcase(type(msg))=lcase("name of screentypemessage goes here") then
if msg.isScreenClosed() then
return "Screen Closed"
else if <some other condition> then
print "do something else"
end if
end if
end while
bosborne
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2012
05:47 PM
Re: Check if screen has been closed?
Can you confirm that during a connection loss, there's nothing I can do to prevent the Roku from kicking back to the main screen?

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2012
10:20 AM
Re: Check if screen has been closed?
If your channel is kicking back to the main screen, that means that some value is not what is expected in your code. You can check if the value is the correct type or is invalid before doing a comparison or using a variable, for example if you are expecting an roXMLElement you can check first:
otherwise, your channel will probably crash when the value is not what is expected, and in a published channel, a crash takes you back to the main screen.
- Joel
if myvar <> invalid and lcase(type(myvar))="roxmlelement" then
doSomeProcess(myvar)
else
handleTheError(myvar)
end if
otherwise, your channel will probably crash when the value is not what is expected, and in a published channel, a crash takes you back to the main screen.
- Joel
bosborne
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2012
05:34 AM
Re: Check if screen has been closed?
I wouldn't necessarily say this is a crash - as Roku pops up a message indicating there was a network connectivity loss, and prompts to being me into the network settings. If it was just a normal crash, I don't think that would happen. I tried by playing a VOD HLS stream and disconnecting the ethernet cable. Then it played out all it had, and I assume when it reached the end and couldn't download anymore it triggered something in the Roku to do that.
Do you have any recommends for debugging this - normally I telnet into the Roku to see debug output. However during a network loss I lose the telnet session and debug output.
Do you have any recommends for debugging this - normally I telnet into the Roku to see debug output. However during a network loss I lose the telnet session and debug output.

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2012
11:27 AM
Re: Check if screen has been closed?
Ah, that. No there isn't any way to detect that in your channel.
Do you know why you are losing your network connection, or is it somehow triggered from within your channel? If it is, can you reproduce the situation where it occurs?
- Joel
Do you know why you are losing your network connection, or is it somehow triggered from within your channel? If it is, can you reproduce the situation where it occurs?
- Joel
bosborne
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2012
04:52 PM
Re: Check if screen has been closed?
Thanks. I'm doing it on purpose to see how the app reacts to a loss of network connectivity. I was experimenting with creating an app that could stream something 24/7 and "restart" itself in case of a network failure. I suppose that is not possible.