"Consistency is the last refuge of the unimaginative.", Oscar Wilde
"Probably the best wish for a dreamer: Be underestimated", 잫읻 젤지옥루
RSS icon Home icon
  • Flash HD Video Players’ Common Mistake

    Posted on March 27th, 2009 Cahit Crcioglu 2 comments

    People are using flash’s fullscreen ability in the wrong way; they are not using the advantage of hardware-acceleration enough.

    I have made a flash player (not-hd supported) in 2005 from scratch. It wasn’t using any flash component related to video playback. So it was’t using skins. Starting from those days, nothing really much changed when opening video in fullscreen.

    After sometime, adobe gave us a big update which lets us use h264 codec in flash. Internet connections got faster and faster, h264 hardware acceleration was started to be used in graphics cards and in many different kinds of devices.

    However  we see many blog posts, articles, tutorials about “how to go into fullscreen” or “true fullscreen mode in flash” or smiliar topics..

    Nearly all of them says we have to use the following:

    function toggleFullScreen(){
        if(Stage["displayState"]=="normal"){
            Stage["displayState"]="fullScreen";
        } else{
            Stage["displayState"]="normal";
        }
    }
    // OR "stage.displayState = StageDisplayState.FULL_SCREEN;"
    // according to the version you use

    Ok. This is not wrong. Infact, you have to do it. But this is not the right way to do it, i was possibly one of the first ones who asked this to adobe, i got no answer and interestingly nobody said anything about my question. ( it was open to public ) After sometime, i saw that that is what it should be. Now i’ll tell you what i’m talking about:

    When you use only the code i just gave, you really go in to fullscreen, but you are using the same resolution of you desktop which really doesn’t use hardware acceleration of the graphics card perfectly. What you have to do, but you don’t is, changing the resolution of the player according to the resolution of the video. So, when applied properly, if your desktop is 1280×1024, but if your video is 640×480, you’ll see that your tracking bar, menu, or anything you show in fullscreen is oversized and looks horrible! At that time, watch the performance of video, it’s flying! Disadvantage of this method is oversized interface elements.. Since you are defining a frame/region and scale it on fullscreen, anything in that screen changes sizes. You have to dynamically calculate the menu interface and draw it accordindly, or if adobe tells us a new way ( or if they already said it, share it with us please ).

    You can easily see that many famous web sites are still NOT using this technic. Since hardwares are going better and better everyday, it’s hard for people to see the performance diffference, who have bought their computer recently.

    I can hear that you are telling about new window modes and hardware acceleration parameters… I had been really excited about those features too until i saw those are not exactly what we ( infact “i”) want.

    Direct and GPU modes. According to me, after applying other methods, you may (shall) additionaly use “Direct” mode. GPU mode is not bad, but if your target audience is not very specific, it’s dangerous. If you use it and the visitor has not a good graphics card, performance may decrease MORE! But if you know your audience and their possible hardware, go ahead and try GPU!

    When i said “famous” sites, i really meaned “famous” sites. This includes global video sharing sites and the ones in Turkey. Many developers may say that this method “is deprecated”, “has no meaning”.. “meaningless”.. “shouldn’t be used”.. “makes no sense”.. “it was for flash 9 only”… I’m sorry you are wrong. Come on! Don’t blame the computer hardware directly, it may not be the only problem.. It’s not hard to make tests for these, and i did. Ok I won’t tell anyone go ahead and try it silently, and apply it if you find it usefull. If you find a better way, or new way to add to these, i’ll be glad to see/learn it. I was not developing on flash for nearly 1.5 years ( but i was reading nearly every news about flash and other adobe developments ). As i said, this may be an outdated method when compared to newest things, but it’s for sure that i still see the difference, and i see that my player shows better performance when compared with famouse video players.

    I hope this blog post helps anyone out there!

    Here is my flash player from 2 years before (: (i have updated it to as3 and changed the way it starts – to put it here)

    Thanks for reading.

    Get Adobe Flash player

     

    2 responses to “Flash HD Video Players’ Common Mistake”

    1. First of all this is a great article! What I would like to say is that if your visitors use windows based computers the “Direct” mode is the best option for them. On the other hand if your visitors use apple based machines the “GPU” mode is the best for them with respect to OPEN GL.

      Also I wonder that why the Global Services (Youtube, Vimeo etc.) are not still in any movement of trying these methods?

    2. @macromania:
      Thanks for sharing your knowledge with us!

      I can only guess:
      “Direct” and “GPU” modes are not yet what we really want. Direct is not something like directx directly and it may end up with the classicial method like when neither Direct not GPU value used. As i know, it tries to find the best way to show it.

      Since Direct is not really showing something very different and GPU is not yet proved itself to many people, i think those companies do not bother changing the stable line – for now.

    Leave a reply