Flash can play up to 1080p video, but in surprisingly a lot of cases the performance is limited by the non-optimized use of the fullscreen mode. In addition to that, FP 10 offers new options for fullscreen acceleration.
Here some tips how to efficiently use the fullscreen mode:
Use the fullScreenSourceRect to define zoom area and switch displayState to “fullScreen”. (Exploring full-screen mode in Flash Player 9)
Performance best practices
- fullScreenSourceRect should match the video object/movie size for best performance
- Avoid video scaling
- Disable smoothing and deblocking
- If possible no video overlays or objects below the video object
- If SWF dimensions are smaller than the dimensions of the video (e.g. 1080p video on 800 x 600 stage), scale the video area and adjust the fullScreenSourceRect to match video dimensions prior to switching to fullscreen. The fullScreenSourceRect is not restricted to Flex / Flash stage dimensions
- If scaling is required, use an even scale factor, e.g. 1/2 or 1/4 or 2x of the original size
In most cases the screen resolution and the actual video size have different dimensions, therefore video controls will change their size in fullscreen. To avoid this behavior a common practice is to use the screen resolution as fullScreenSourceRect, keep the scale of the controls and scale the video object to match the full screen dimensions. This can impact the performance of the video, especially on larger screens and with HD content.
Video control best practices
- Flash Player 9 – Use the method above with care and only if performance impact is acceptable and UI is more important (SD content/ low screen resolution)
- Flash Player 9 – Since the video resolution of HD content it closer to screen resolution, evaluate if a minor pixilation of controls is acceptable for HD. In this case use video object/movie size as fullScreenSourceRect, and perform minor resizing of the video controls.
- Flash Player 10 – The method above is acceptable if the GPU accelerated mode (via wmmode “gpu”) is used with the fullscreen mode. Do not use fullScreenSourceRect in this case and simply switch with displayState to fullscreen. Since it’s not possible to zoom to a certain area without the fullScreenSourceRect, simply zoom on the stage to the desired area when in fullscreen. The GPU acceleration will minimize the performance impact.
Dynamic streaming normally includes video streams with different dimensions. Since it’s not possible to switch the fullScreenSourceRect during fullscreen mode, and the maximum screen resolution is sometimes hard to predict with changing network conditions, one option is to use the dimensions of the highest bitrate video clip as fullScreenSourceRect.
- To avoid quality issues with lower bitrates, turn on smoothing in case the stream dimensions don’t match the video object size.
- This method might impact the performance, since streams with smaller dimensions need to scale to the video object
An alternative method is to predict the maximum possible resolution and use it as default fullscreen resolution. This might not offer the best possible quality under certain conditions (in case of upgrade to higher video quality/size during fullscreen), but offers the best performance.
If you use Flash Player 10 with GPU fullscreen (described above), multiple bitrate is not an issue – it’s possible to change the scaling during transition.
More information
Flash Player 10 GPU mode (Tinic Uro).
Exploring full-screen mode in Flash Player 9 (Adobe Developer Connection).
Thanks for the article . ?However I am not sure if I clearly understand it
Flash Player 10 – The method above is acceptable if the GPU accelerated mode (via wmmode “gpu”) is used with the fullscreen mode. Do not use fullScreenSourceRect in this case and simply switch with displayState to fullscreen. Since it’s not possible to zoom to a certain area without the fullScreenSourceRect, simply zoom on the stage to the desired area when in fullscreen. The GPU acceleration will minimize the performance impact.
So you mean not to use this
var fullScreenRect:Rectangle=new Rectangle(0,0,playerwidth,playerheight);
stage.fullScreenSourceRect=fullScreenRect;
stage.displayState=StageDisplayState.FULL_SCREEN;
And just do
stage.displayState=StageDisplayState.FULL_SCREEN;
H i George, the article is actually a bit deprecated (it is from 2009). I would strongly recommend using StageVideo now, zoom in with fullScreenRect is not required anymore.
@jensloeffler Thanks for quick reply
I have code like this
var fullScreenRect:Rectangle=new Rectangle(0,0,playerwidth,playerheight);
stage.fullScreenSourceRect=fullScreenRect;
stage.displayState=StageDisplayState.FULL_SCREEN;
Do you mean that stage.fullScreenSourceRect=fullScreenRect; is not needed anymore ? I was checking this document http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html and for some reason my flash quality is bad after fullscreen . I checked OSMF code which does use Rectangle and looks a lot better in quality for some reason .
The fullScreenSourceRect was there to accelerate the zoom to the video area when going to fullscreen, otherwise performance would have been poor. StageVideo was introduced after I wrote this article, and is what I would recommend overall for video playback and and fullscreen (enable StageVideo, go to fullscreen, set the StageVideo to screen dimensions). http://www.adobe.com/devnet/flashplayer/stagevideo.html
Just to clarify, you can still use fullScreenSourceRect zooming with StageVideo. The downside of fullScreenSourceRect is that the controls will zoom in as well in fullscreen mode, making them look blurry. With StageVideo, fullScreenSourceRect is not required anymore – if you scale the StageVideo in fullscreen mode, it is HW accelerated, and the controls remain crisp / unscaled.
Thanks you for directing me to StageVideo .