views:

41

answers:

3

Users of my Flex application report that sometimes the application is freezed when the browser window is minimized or they select another active tab over it. In this suspended state, the application receives no CPU share and all network connections it uses are closed. When the browser window is restored, the application is resumed. This happened with Safari 5 on Mac OS Leopard, with both Flash player 10.0 and 10.1. I searched a lot but I could not find any information about such behavior.

This behavior is not reproducible on each Mac with Safari, so my questions are:

Under which circumstances this may happen?

Is it possible entering in suspended state to be prevented and how?

Is it possible for the Flex application to be notified about going into sleep mode and wake up back?

A: 

Are your users using Flash Player 10.1 ? As part of the performance improvements in 10.1; I believe an application in a minimized state will get throttled in order to use less system resources / battery power.

I don't think there is any way to prevent this; and no APIs exposed that relate to this.

Other people I've spoken to have had issues with using local connections between minimized apps and active apps. I'd bet there is already a bug in the bug base on that.

www.Flextras.com
Just to be clear, 10.1 does not go to sleep, it has a throttled frame rate in this state. Tinic's articles on this are the go to for this behaviour: http://blog.kaourantin.net/?p=82You are correct and LocalConnection is also throttled in this state. This is by design, and not a bug.
David Collie
David; good stuff I hadn't seen those blog posts yet.
www.Flextras.com
@Flextras: I'm afraid it happens on both 10.0 and 10.1 players, I'll update the description accordingly.
Vladimir Grigorov
@David Collie: very, very nice link!
Vladimir Grigorov
Vladimir; I'm at a loss then. Sorry I couldn't be of more help.
www.Flextras.com
A: 

This is a Safari thing and is by design. Newer versions of Safari suspend flash content that is not in the foreground tab (not sure when this started, version 4?) For instance, if you have multiple tabs open, each with a youtube video playing and you go back and forth between the tabs, only one of the videos will be playing at a time. To answer your specific questions:

  • This will happen to any flash content that is in a background tab (not sure about the minimized state.)
  • Not aware of a means of disabling this behavior.
  • You may want to dig around in the Safari documentation to see if there is some sort of JavaScript event that you can grab onto, but I don't think you are likely to have success there.

Good luck.

Wade Mueller
It seems it doesn't happen every time - I tried it with Safari 4 and 5 on a Snow Leopard and all the tabs keep playing simultaneously. I wonder when and why this happens...
Vladimir Grigorov
A: 

Wrt the following above:

.I don't think there is any way to prevent this; and no APIs exposed that relate to this.

You may want to check out if Silverline from Librato can help you control how much and which applications get what system resources (CPU, memory, Disk and Network IO) with dynamic control based on application demand. If the above issue is a feature of flash - then obviously it may not help. But if you are trying to say run multiple applications / processes and would like to control who gets how much system resources (dynamically) then you could try Silverline - it does not require any changes to OS or app. http://silverline.librato.com

sshalini