Mar 27, 2011
I'm continuing work on my talk for FITC Toronto 2011 on OSMF and Stage Video in Flash Player 10.2 (although I've come up with a much better title, which will hopefully be updated on the event site shortly).
As I'm doing a bit of research to fill in the details, I'm realizing that the documentation around the WMODE parameter (used when embedding the Flash Player in a web page) can be a bit confusing — in part, because for so long, WMODE was rarely used, and now its usage has changed three times with the last three Flash Player releases. And, at the time that I'm writing this post, Adobe's documentation page explaining WMODE's usage doesn't appear to include any of the information from these three major releases.
Prior to Flash Player 10, WMODE was really only used when you wanted your SWF to render transparently (most commonly, on top of other web page content):
wmode– Possible values: window, opaque, transparent. Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser.
window– movie plays in its own rectangular window on a web page.
opaque– the movie hides everything on the page behind it.
transparent– the background of the HTML page shows through all transparent portions of the movie. This option can slow animation performance.
With the introduction of Flash Player 10, WMODE assumed new importance, as usefully described by Tinic in a blog post at the time:
direct: This mode tries to use the fastest path to screen, or direct path if you will. In most cases it will ignore whatever the browser would want to do to have things like overlapping HTML menus or such work. A typical use case for this mode is video playback. On Windows this mode is using DirectDraw or Direct3D on Vista, on OSX and Linux we are using OpenGL. Fidelity should not be affected when you use this mode.
gpu: This is fully fledged compositing (+some extras) using some functionality of the graphics card. Think of it being similar to what OSX and Vista do for their desktop managers, the content of windows (in flash language that means movie clips) is still rendered using software, but the result is composited using hardware. When possible we also scale video natively in the card. More and more parts of our software rasterizer might move to the GPU over the next few Flash Player versions, this is just a start. On Windows this mode uses Direct3D, on OSX and Linux we are using OpenGL.
With Flash Player 10.1, the hardware acceleration behaviors were updated:
In addition to hardware H.264 decoding, mobile devices that support access to OpenGL ES 2.0 can use Flash Player 10.1 to render all graphical elements (except Pixel Bender shaders) using GPU hardware to increase graphics performance. Desktop players will continue to use software rendering; support for hardware rendering is expected in a future release.
Hardware rendering in Flash Player 10.1 differs substantially from the GPU support available in Flash Player 10. The earlier feature, known as hardware compositing or GPU compositing, involved Flash Player using the GPU to layer (composite) graphics when the HTML page included the wmode=gpu embed parameter. In Flash Player 10, the software renderer draws individual graphical elements and then the resulting image is composited to the screen by the GPU using the appropriate blend mode.
Although hardware compositing in Flash Player 10 improves performance in some cases, it can decrease performance in others. In addition, driver support varies widely on desktops. Given these challenges, Flash Player 10.1 on the desktop also composites SWF content included with the wmode=gpu embed parameter in software.
In contrast to the earlier hardware compositing, the new hardware rendering capability available in Flash Player 10.1 uses the GPU rather than with the software renderer to draw graphics. This shift yields dramatic performance improvements with optimized content. Hardware rendered objects include vector graphics, bitmaps, video, text, and filters. With hardware rendering, the GPU renders and composites graphic elements.
Flash Player 10.1 hardware rendering is automatically enabled on supported devices, and it's not necessary to add the wmode=gpu embed parameter to enable it. However, when working with Flash Player 10.1, the wmode=opaque or wmode=transparent embed parameters will disable hardware rendering, causing the software to render the graphics.
Now, with Flash Player 10.2, Adobe has included a feature known as Stage Video, which is designed to further accelerate playback of higher-quality video. One of the catches? You should set the WMODE parameter to "direct" (as opposed to "gpu", which was established as the default with Flash Player 10.1) in order to utilize Stage Video to ensure consistent playback on desktop, mobile and TV devices (note that on the desktop, Stage Video can be used in Full Screen playback mode, regardless of of the WMODE setting):
To make sure stage video will be available, you must use wmode="direct" at all times. This mode is highly recommended for video playback. It uses Direct3D on Windows and OpenGL on Mac OS and Linux to actually perform video frame compositing directly through the GPU. The limitation is that, in this mode, Flash Player runs in its own context and having overlapping HTML content on top of the player is not possible, for instance. If you decide to go with any other mode, such as wmode="window", wmode="opaque", or wmode="transparent", you highly decrease the chances (see note) to have stage video available. As a result, for consistency, it is highly recommended to use wmode="direct" at all times.
Before Flash Player 10, you basically used WMODE only if you wanted to make your SWF transparent (which you can still do).
With Flash Player 10, you had to use the WMODE parameter to implement hardware acceleration (at your own risk).
With Flash Player 10.1, Adobe not only improved hardware acceleration, but also made it the default WMODE setting (meaning, once again, you could safely go back to ignoring the WMODE parameter unless you wanted to utilize SWF transparency).
Now, with Flash Player 10.2, you are encouraged to set WMODE to "direct" if you wish to utilize the Stage Video features available in the latest player to improve the quality of the HD videos you are able to deliver to your viewers — this ensures compatibility of video playback on the desktop and mobile and set-top devices — otherwise, you are encouraged to leave it at the default "gpu".
And, don't forget that WMODE="transparent" is still supported in all of these versions (though its usage is discouraged as it conflicts with all hardware acceleration and its performance is not supported on many mobile devices).
Simple enough, right?