I have a VideoDisplay that is able to connect to a source and play. After the connection times out I want the connection to be re-established when my play button is clicked. Right now when I reset the source and play the videoDisplay, it gets stuck in the loading state.
need to set source to null then back to your intended source and call load() then set the playhead position
Related
I know how to open windows in Alloy, but I am worried about the effect on performance of opening lots of windows. In Classic titanium, you had to manage this carefully to avoid memory leaks, but i've seen very little on this for Alloy. Is this handled somehow by Alloy behind the scenes - can I just keep opening windows to my heart's content?
So if I have index.js opening category.js, which then opens product.js, but there is a button to open index.js - how do I handle that?
Try this: https://developer.appcelerator.com/question/176491/alloy-close-the-window-clear-the-memory
Simply closing the window does not free up any memory that has
references open from within the menu or any child views/function of
the window. It is common to create a cleanup method and publicly
expose this from the controller. You then make sure that anything you
created or referenced inside this controller has been nulled, removed
or reset - within this function. Add an event listener to the window
inside the controller to handle the close event and then have it call
the clean-up function. Finally removing that event listener as well.
Some things to check for in your clean-up function Event Listener -
use Remove Event Listener once they are nbo longer required For tables
simply use table.setData([]); nothing more complicated than that If
you use setTimeout or setInterval you must always clear(thing) each of
these There are more but these are the highlights.
I am building a flash player (Flex 4.6) to display a live stream from a camera. If connection is slow, the VideoDisplay state is "LOADING" or "BUFFERING", and I need to show a spinner (gif file) when it happens.
Is there a way to set up a listener like this one:
stage.addEventListener(Event.FULLSCREEN, doThisOnChange);
which would listen to VideoDispaly events rather than FulllScreen events? Couldn't find anything so far..
Would be very grateful for any advice.
I'd like to tell if a certain key is being held down around the startup of my AIR (desktop) application, and I'd like to tell if a specific key (ALT in this case) is being held down. Unfortunately, flex seems to be so event based that there is no way poll the keyboard directly. Can anyone verify this?
I know that it's possible to take the keyboard events and keep track manually. However, this won't work if the user presses the key right before startup, so it isn't a solution for my specific problem.
In my app I track ctrl pressed via listening stage MOUSE_MOVE, MOUSE_DOWN and KEY_DOWN. MouseEvent has ctrlKey and altKey properties. I store state in some static variable . When I longer need this I unsubscribe from these events.
If you listen for key up, then you should hear this if the key was down. So you won't actually know right at startup, but when they release the key. You can unsubscribe from that event at some point that you determine is "after startup."
I'm currently building an air app with FB 4.
I have a custom control that contains a VideoDisplay control, and which loaded using the PopupManager.
Using the profiler, i've noticed that every time the my popup is loaded the memory for it gets allocated, but when it's closed the memory is never recovered.
There's nothing else holding a reference to the popup. And if I don't set the source of the VideoDisplay object, then there is no leak - but as soon as the source is set I get a leak.
I can't see any method to force close the stream or anything on the spark VideoDisplay control.
Any idea or suggestions?
EDIT: I have tried setting the source to null before closing the popup but that doesn't change anything.
Also, I'm not holding any event listener to the video.
Edit 2: It doesn't happen if I replace the spark VideoDisplay with an mx VideoDisplay. Bug in the spark component?
I dont have a solution, but just wanted to add that I have had the same issue.
I have a 'screensaver' which just loops the same video over and over (and over...). The component is initialized (but hidden and paused) when the app starts, and comes into view when the app is idle.
Each time the video restarts, more memory is allocated even though it is the same video and only 'play' is called (the source never changes).
I think your assumption of a bug in the spark component is correct as by replacing the videodisplay with the old mx component fixed the issue.
I have a videoDisplay object in a popup.
When I remove the popup the video continues to play.
How do I remove the videoDisplay object from memory?
I have tried setting the variable to null but with no luck. I can just call the stop() function and forget about it but am wondering whether this won't come back and bite me.
Any help much appreciated.
Stopping would be enough. Remove any event listeners attached to it to make sure that it is garbage collected. If the control is is streaming from the Flash Media Server, call the close() method after calling the stop(). The close method forces the close of an input stream and connection to Flash Media Server.