cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
01:10 PM
Screen Pops but lose control
I am trying to pop screens (per the API example) and am getting mixed results. Can someone please help me out. This seems to be the last issue I need to overcome with the player.
Assume a simple case where I have screen A that is a home screen and it can invoke screen B. The user wants to close screen B. Screen B should close, screen A should now be open. I do this, and I have an "exit while" statement in my event handler in B. Yet, while I can go from B to A, I can not then go anywhere else as I have lost focus and can't get it back. Can someone help me see the light please?
erstwhile...
I find that the above will take me back to the screen I want to go to. However, it will just not give me focus back. Can someone help please?
Function popAndShow(screenArray As Object) As Void
screenToClose = screenArray.Pop()
screenToShow = screenArray.GetEntry(screenArray.Count() - 1)
screenToClose.Close()
screenToClose = invalid
screenToShow.Show()
End Function
Assume a simple case where I have screen A that is a home screen and it can invoke screen B. The user wants to close screen B. Screen B should close, screen A should now be open. I do this, and I have an "exit while" statement in my event handler in B. Yet, while I can go from B to A, I can not then go anywhere else as I have lost focus and can't get it back. Can someone help me see the light please?
screen a = createObject("roPosterScreen")
screenArray = createObject("roArray", 1, true)
screenArray.push(a)
...
while true
msg = wait(0, a.getMessagePort())
... can't close this screen so just do what the user asks when the user is here.
... user wants screen b so...
b.show()
erstwhile...
screen b = blah, blah
screenArray.push(b)
while true
msg = wait(0, b.getMessagePort()) 'port is the same as a's
if msg.isScreenClosed()
popAndShow(screenArray)
exit while
I find that the above will take me back to the screen I want to go to. However, it will just not give me focus back. Can someone help please?
13 REPLIES 13
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
03:51 PM
Re: Screen Pops but lose control
Looks like I finally figured out how to make this work. I had a method that took care of all this and, for whatever reason and even when I could see the order of closing was right, I was just not getting back control. I created something of a factory controller which manages all this for me now. As I'm tying everything back together, it seems like it works much more smoothly with that factory in the middle of everything.
dynamitemedia
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
04:04 PM
Re: Screen Pops but lose control
you should share how you got this to work, could be useful
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
08:11 PM
Re: Screen Pops but lose control
Actually, I came back in to say that I did not get it to work and there could be a problem in the Roku which is driving me crazy.
I now have a factory object that takes care of anything and everything nicely. It opens and closes smoothly on any screen. But, consider the following scenario...
Screen a is a selection of videos (which may be deep in a tree). You can navigate up and down the tree fine. Then, pop another onto your tree (play the video) and create a roVideoScreen. Interrupt it. Go back... That will work fine and you'll get back to screen a if you pop and show.
However, let's now assume the user does not interrupt and go back but instead plays another video and interrupts it and then decides to get out of screen a altogether (to see another category perhaps). If I play twice and interrupt twice, I can continue selecting and playing on screen a. But, if I decide to leave screen a, the screen prior to it will not open and I'll get a blank screen. This is despite the fact that the same controller is using the same methods to close screen a that it does every other time a user closes (without getting all the way to playing a video for instance). To demonstrate this in a chain form...
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three
I can go up down and sideways on all those screens with no problem. Now...
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three ---> play the video
I can still go up down and sideways on all screens (as many times as I like) but do this and it all goes to hell:
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three ---> play the video ---> interupt video ---> pop and show roPosterScreen three (iterate as much as you like) <---- go back
Now you'll get a blank screen and the player is dead.
This has cost me a lot of hours of my life. If someone can point out what I could be doing wrong, I'd love to hear it. It makes no sense that the code that manages all this can do it all fine and will have absolutely no issues with any combination of screen pops until you play and interrupt videos a couple of times.
I now have a factory object that takes care of anything and everything nicely. It opens and closes smoothly on any screen. But, consider the following scenario...
Screen a is a selection of videos (which may be deep in a tree). You can navigate up and down the tree fine. Then, pop another onto your tree (play the video) and create a roVideoScreen. Interrupt it. Go back... That will work fine and you'll get back to screen a if you pop and show.
However, let's now assume the user does not interrupt and go back but instead plays another video and interrupts it and then decides to get out of screen a altogether (to see another category perhaps). If I play twice and interrupt twice, I can continue selecting and playing on screen a. But, if I decide to leave screen a, the screen prior to it will not open and I'll get a blank screen. This is despite the fact that the same controller is using the same methods to close screen a that it does every other time a user closes (without getting all the way to playing a video for instance). To demonstrate this in a chain form...
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three
I can go up down and sideways on all those screens with no problem. Now...
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three ---> play the video
I can still go up down and sideways on all screens (as many times as I like) but do this and it all goes to hell:
Home Screen ----> roPosterScreen one ---> roPosterScreen two ---> roPosterScreen three ---> play the video ---> interupt video ---> pop and show roPosterScreen three (iterate as much as you like) <---- go back
Now you'll get a blank screen and the player is dead.
This has cost me a lot of hours of my life. If someone can point out what I could be doing wrong, I'd love to hear it. It makes no sense that the code that manages all this can do it all fine and will have absolutely no issues with any combination of screen pops until you play and interrupt videos a couple of times.
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
08:17 PM
Re: Screen Pops but lose control
In reading my post, to be as accurate as possible, the ONLY time it dies is if I play two or more videos from any one poster screen and then try to go up the chain. If I only play one, or I go up and down the chain in any other combination, there's never a complaint. But, play two or more videos and try to go back and the Roku goes dead.
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2010
09:34 PM
Re: Screen Pops but lose control
Still not solved, but I have a hanky-janky patchwork that screws up the way I want my app to work but at least I can guarantee that it stays running now. For whatever reason, you can't play twice and then pop back to a screen prior to one that has your posters for video selection (at least I can't). So, I'm now popping twice any time I see the player close to take the user back to the third screen. Then I force it to reload the 4th screen which the user plays videos on. Again, if I leave the user on the 4th screen they can select and play as many videos as they like. Then when they try to go back (unlike every other case) they get to look at a black screen. If anyone else has this problem, there's how to solve it for now. LOL.
I can't keep messing with this any longer. I literally went Friday and Saturday without sleep and finally went to bed on Sunday at midnight, all over this. I even missed a plane flight (I have a really pissed off girlfriend now) and I still don't have it solved.
I will come back and show you how I got good quality screen flow with a factory tomorrow after I have finished tying this app back up, now with a two screen pop at the end of the chain.
I can't keep messing with this any longer. I literally went Friday and Saturday without sleep and finally went to bed on Sunday at midnight, all over this. I even missed a plane flight (I have a really pissed off girlfriend now) and I still don't have it solved.
I will come back and show you how I got good quality screen flow with a factory tomorrow after I have finished tying this app back up, now with a two screen pop at the end of the chain.
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2010
07:46 AM
Re: Screen Pops but lose control
Oh well. I'm sure the ultimate problem is that I skipped three days of sleep (I'm not joking) to try to make this deadline - which was a long shot given when I started learning the player anyway. Seems easy but I just can't seem to get control back when I want it right now. I'm sure I'll get 12 hours of sleep and then everything will work. Bummer all around.
Good luck.
Good luck.
RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2010
01:42 PM
Re: Screen Pops but lose control
In your code snippet above, you are using the same while loop for all your screens, and you are always getting the port to wait on from screen b. Yet, in popAndShow() you call Close() on the screens one of which may be the required screen b. When you call Close() on screen b and then call wait on b.getMessagePort() you are trying to get a port from an object that no longer exists....
I recommend you structure your code to have a method per screen that sets up the screen then calls an event loop for the screen that uses the port that screen was set to.
You have the right idea about managing references to screens for a non stack based navigation, but you must take care in getting this code all correct and testing every possible navigation. Make sure this non-standard navigation is worth the extra complication in your code. (Sometimes it is like when you create a 'new station' in Pandora and jump to that new station, but then when exiting the station you go back to the home screen not the new station screen because the new station screen had been previously closed).
--Kevin
I recommend you structure your code to have a method per screen that sets up the screen then calls an event loop for the screen that uses the port that screen was set to.
You have the right idea about managing references to screens for a non stack based navigation, but you must take care in getting this code all correct and testing every possible navigation. Make sure this non-standard navigation is worth the extra complication in your code. (Sometimes it is like when you create a 'new station' in Pandora and jump to that new station, but then when exiting the station you go back to the home screen not the new station screen because the new station screen had been previously closed).
--Kevin
cpawinsal
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2010
03:37 PM
Re: Screen Pops but lose control
I'm freakin tired so I don't know if I posted or not - I showed an example of how to use my factory, one thread (home) and what the considerations therein are. I must have killed it though. But, basically, I figured all this out.
If I had used normal software practices, I could have fixed this in 15 minutes. Unfortunately, my code was a hodge podge of futility so I've no one to blame but me. It's all good though. And, now that I get the SDK, I sincerely can't believe how easy it is and how I could have had ANY problem with it whatever. I could teach a kid to do this now.
BTW, it would be nice if someone opened up an open source project on the SDK. An eclipse plug in or perhaps a java API that outputs members as BrightScript or xml instantiation or anything with an IDE. About 90 percent of my problems were mispellings that are not caught until compile (as well as type declarations ";" at the ends of my calls... lol). Plus, writing in Emacs (better than nothin') is miserable for me.
I have a perfect channel coming together now. 🙂 I use roAssociative arrays to hold my screens BTW. Given that I'm tracking the user in one place, it should be impossible to navigate away from my focus unless you navigate all the way out of the app. I take it from your reply that you don't agree with that?
BTW, the reason I used the same message port in all threads was due to the API ("You can create a port per screen... but you should use just one"). Perhaps a little discussion of the consequences of doing that would be good at that point in the doc.
Thanks for your help.
Cheers,
Al
If I had used normal software practices, I could have fixed this in 15 minutes. Unfortunately, my code was a hodge podge of futility so I've no one to blame but me. It's all good though. And, now that I get the SDK, I sincerely can't believe how easy it is and how I could have had ANY problem with it whatever. I could teach a kid to do this now.
BTW, it would be nice if someone opened up an open source project on the SDK. An eclipse plug in or perhaps a java API that outputs members as BrightScript or xml instantiation or anything with an IDE. About 90 percent of my problems were mispellings that are not caught until compile (as well as type declarations ";" at the ends of my calls... lol). Plus, writing in Emacs (better than nothin') is miserable for me.
I have a perfect channel coming together now. 🙂 I use roAssociative arrays to hold my screens BTW. Given that I'm tracking the user in one place, it should be impossible to navigate away from my focus unless you navigate all the way out of the app. I take it from your reply that you don't agree with that?
BTW, the reason I used the same message port in all threads was due to the API ("You can create a port per screen... but you should use just one"). Perhaps a little discussion of the consequences of doing that would be good at that point in the doc.
Thanks for your help.
Cheers,
Al
RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2010
03:43 PM
Re: Screen Pops but lose control
Using one message port for all your screens will work fine... The problem with the code sample above was that the port was being referenced from a particular screen that may have gotten closed:
When a goes away, don't try to get its port !
Glad to hear you've straightened things out.
--Kevin
wait(0, a.getMessagePort())
When a goes away, don't try to get its port !
Glad to hear you've straightened things out.
--Kevin