Friday, April 09, 2010

Press any key to continue

The recently released Flash Player 10.1 rc contains a couple of enhancements which are worth of a quick note.

Screen savers and video playback

An annoying behavior in older Flash Player versions is the fact that passively consumed content, video specifically, does not prevent the screen saver from kicking in. After some conversation here internally we think we finally have a good answer how to solve this problem. If all of the following conditions are true the screen saver is prevented from kicking in even if you are not in full screen mode:

1. Video is playing
2. Video is not paused or stopped
3. Video is not buffering
4. Sound is playing
5. Sound has a volume (this makes sure that silent ads do not cause harm)
6. The SWF is currently visible (with some caveats on platforms and browsers, see next paragraph)

So no more tapping the keyboard while you are watching a video!

Determining the visibility of SWFs

In my previous post I have mentioned that we now throttle the player whenever a SWF is not visible. Well, I wish we could make this work consistently. As of today we can not always determine if our instance is visible. There is no standard way of doing this, every browser works slightly different.

Here is the current status:



IE
7/8
Win
Firefox
3.6
Win
Opera
10.1
Win
Safari
4.0.x
Mac
WebKit
nightly
Mac
Firefox
3.6
Mac
Firefox
3.7
Mac
Firefox
3.x
Linux
We know if our SWF instance is on a hidden tabYESYESNONOYESNONONO
We know if our SWF instance is scrolled out of viewYESNONOYESYESNOYESNO

Each time you see a NO we can not throttle SWFs to use less CPU resources. These limitations are dictated by the browser so it will take some time to sort this out.

If you have Flash Player 10.1 rc installed, here is something simple to try out: Go to this page (skip the ad):http://www.nickjr.com/kids-games/ants-adventure.html. Now either put the page on a hidden tab or scroll to the bottom of the page so the SWFs are not visible. In IE on Windows and WebKit nightly on the Mac you should see that the CPU usage drops significantly after a couple of seconds because we throttle the SWFs.

I believe this problem can be easily fixed in Firefox Mac and most of the other browsers going forward. On Linux however this will be much more tricky because of GTK (the framework we have to use). We will probably need a special NPAPI extension and lots of browser changes to make this possible.

0 Comments:

Post a Comment

<< Home