Flash crashing as VOIP client - actionscript-3

I have a web application with three states.
Dial in — (basically, none of the below)
VOIP — Connected to a Freeswitch instance
Listen — this option is through a normal connection to an FMS instance (different server from #2).
The initial state is chosen via a pop-up when the user first enters the application. From then on, these are all controlled by a ComboBox. When it changes, the application checks for all open connections and then closes them. It then opens the appropriate new connection.
The problem is that sometimes this causes the application to freeze for 10-20 seconds, and sometimes it causes it to crash and I have no idea why. traces which should fire before the VOIP change only appear after the freeze (there will be a delay in the timestamps), but if I comment out the call to the change function, they appear in the order expected.
What is going on? Is this architecture simply not tenable? Is there a better way to do things?

Apparently... the connections were a red herring.
After looking at the results on the server, it became apparent that the problem was with placing the call to the processing functions inside of a Flex generated EventListener. The previous developer used the change="handler(event)" property which was causing the crash. When I switched over to <voip-drop-box>.addEventListener("change",function(e:Event):void{});, everything cleared up instantly.

Related

Is it possible to reopen closed NetConnection?

I have an application that records camera and mic of users and saves it on Adobe Media Server.
The application itself works fine, but recently, I started having many cases in which the audio and video was being cut, and turns out that Flash is disconnecting from the server every once and while.
Due to how the application was designed, every time it detects a disconnection (NetConnection.Connect.Closed) that was not triggered by the user, it opens a new connections and starts recording again (using the same target file).
The problem with this workflow, is that during the period where there is no connection, nothing is recorded, causing a cut effect similar to what Youtube vloggers do.
Since I cannot migrate a stream from one connection to the other, I was thinking in calling netconnection.connect(url) to the same URL, but when I did it, nothing happened, no NetStatus event is triggered.
Is it possible to resume an interrupted recording without having to ask the user to patiently wait while a new connection is opened?
P.S.: This started be an issue recently on IE and Edge, every other browser works fine.
Yes, it is possible to reopen the connection, but that must be done outside the NetStatus event scope.
You can either use setTimeout(function(){reconnect()}, 100) or trigger another event that will do the reconnection.

Relaunch WinRT app when suspended

I have a personal WinRT app I'm working on, and when the app is suspended, I would like to have it relaunch itself with different launch parameters.
I know you can kind of already do this with toast notifications, but I would like to know if it's possible to do without any user interactions.
Thanks!
Wow. I never thought of this before. Your only hope would have been to re-launch your application during the suspending event using protocol activation. But what happens is it is not re-launched, it is reactivated while in the suspending state and the activation is denied. You can't delay the re-activation either because all thread schedules are suspended once the app is terminated, too. I tried this in a test app just now and I'm right.
There's also no option with somehow triggering a background task. Though the ApplicationTrigger is coming with Windows 10, the rule still remains that a background task cannot invoke any UI. So, you can't use a background task.
Then I thought about file activation. Then I realized that file activation is identical to protocol activation and the result would be the same, too.
Yes, the idea of using a timed toast or scheduled reminder would sort of work. It would certainly require the user to tap the toast, and if toast were disabled, or the user didn't tap them (they are transient), you are left not running and nothing going to start you.
There is one more thing you can do. Since there isn't a WinRT solution here, remember there's almost always a Win32 solution. There is nothing wrong with a Win32 in-memory app listening for your app to be terminated and starting it again (like by using protocol activation). Your problem is solved unless you are running this on an ARM device - hopefully not.
I talk about protocol activation here:
http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html
Best of luck!

ApplicationIdleDetectionMode and WebBrowser functionality in WP8

In WP8, if we set
ApplicationIdleDetectionMode = IdleDetectionMode.Disabled
the app continues to run even when the screen is locked.
If, for instance, we have a WebBrowser in an app (which is actually active only when the app is in the foreground), and the above property is set as disabled:
Will the WebBrowser continue its execution even when the screen is locked (for example, playing an audio file).
Will the WebBrowser continue its execution even when the app is switched to the background.
Thanks.
As for running under lock screen - yes it should run, you can get more information from MSDN.
As I have tested once, WebBrowser is using BackgroundAudio to play (audio element), so it should also play under lock screen and probably in background (thought you should test it).
When the App goes to dormant state - all its processes are stopped MSDN:
When the user navigates forward, away from an app, after the Deactivated event is raised, the operating system will attempt to put the app into a dormant state. In this state, all of the application’s threads are stopped and no processing takes place, but the application remains intact in memory.
You should also watch out for Certification requirements, when usind AppIdleDetection - point 6.3 – Apps running under a locked screen.

How can I pre-start my RAP application to trigger warmup right after startup

I have a RAP application which we deploy into a Tomcat instance. The application does some additional stuff during it's first startup.
Currently when the first user opens the webpage in a Browser, it takes quite a while until the application is ready because of this one-time initialization work.
This is bad for usability as the first user needs to wait a long time until this startup-work is done.
Is there a way to trigger or simulate a first session after the Tomcat is started so we can warmup the application and the first user receives feedback quickly?
I tried to do some simple URL-requests via URLConnection to simulate a browser, but it seems the protocol to trigger a new session is non-trivial.
I also tried to use HtmlUnit to request the page with JavaScript enabled, this works to some degree, but HtmlUnit is quite heavy for this simple step.
So is there an official API or at least some sort of workaround that allows me to pre-start and initialize the application?
Unless this initialization requires a UI session (i.e. a user), the configure method of your ApplicationConfiguration could be a suitable place. However, at this point, the ApplicationContext has not been completely set up, so it could be too early. Also, if your application is based on the workbench and extension points, you won't have an ApplicationConfiguration of your own.
Would you mind opening a bug report (http://eclipse.org/rap/bugs) and describe your use case? I think we should provide some kind of hook for applications to setup and clean up, e.g. an ApplicationContextListener?

Flash/Actionscript 3: When does flash stop rendering and how to keep active?

I have a flash/Actionscript 3 application (swf). This application sends a message to a server every 2 seconds. However, in some browsers/operating systems (for example, safari in mac), the moment the browser loses focus, it stops sending these messages.
I send these messages in a EVENT.ENTER_FRAME loop, so every time the application is rendered I have the chance to send a message. My theory is that some browsers apperantly stop callling this method/stop rendering for some reason, because it has lost focus. However, I want to keep sending these messages.
I already tried to use a Timer, an event that would be called every 2 seconds, but I read somewhere (and my tests seem to agree) that this timer is also connected to the rendering/frame entering, so that timed function will also not be executed.
Is there a way to do what I want?
You can use the MOUSE_LEAVE stage event to check when your swf has lost focus.
What I would recommend is using the ExternalInterface to establish a connection between the swf and javascript. As soon as the connection is done, have javascript call your server instead of flash, that may loose focus.
Out of curiosity, why would you need to poll the server every 2 seconds ?