Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Resizing player with window resize

2010-07-09
2013-05-28
  • Paul Lunneberg
    Paul Lunneberg
    2010-07-09

    In an older version, the player would resize its UI properly if the flash object was resized in the html window.  In more recent versions this has been removed.  What is the easiest way to add this functionality back in? 

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-07-09

    Ok.. i'm being a little dense today.. all figured out…

     
  • Irene Hu
    Irene Hu
    2010-07-09

    How did you figure it out? I've been wondering about this, but never asked.

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-02

    Turns out I didn't have it all figured out. I'm still trying to get this to work easily so I can add code to new releases of the player simply.  Basically, you should be able to add a listener to the stage or base movie and have it call the built in resize functions.  Though the latest versions of the player are a bit more complex and its not as simple as it once was.  If I find a reliable solution I'll post it up here.

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-02

    According to the documentation:

    Dynamically scalable. All views are re‐scaled and positioned each time the flash player is resized.

    This, however, is incorrect.  I'm still trying to figure out where and how to add this functionality back in.  Currently if I resize a window that has html with the embeded player inside it, the player stays at the same size and is cut off at the bounds of the newly resized flash object.

     
  • Dean Stringer
    Dean Stringer
    2010-08-02

    Pablo. Have you tried listening for the stage resize event? The following may be useful, it concerns full-screen switching but you may be able to detect container size changes in the same way:
    http://www.adobe.com/devnet/flash/articles/liquid_gui_03.html

     
  • Dan Sparacio
    Dan Sparacio
    2010-08-02

    Pablo,  Are you embedding your swf with fixed width and height?  You need to set the width and height on the embed tag to 100%..  I will post an example soon when I can get some time to do so.  Let me know if this post helps.

    Thanks

    Dan

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-03

    I'm embedding with swfobject with the width and height each set to 100%.  I submitted a bug for the actual player as a fix that was introduced in version 2.1.3 I think it was actually removed the stage listener for resizing and removed this functionality unless your using the playlist capability.

    Also… when compiling the AmakaiMultiPlayerExample.fla it doesn't have all the functionality of the AkamaiFlashPlayer.swf release version.  It compiles smaller and some of the text doesn't display.  Not sure why its different.  Not sure what is used to compile the AkamaiFlashPlayer.swf.  I'm using Flash 10 with the default flash compile settings in that FLA.

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-03

    I have tried to add the stage event listener myself but as I mentioned in my last post above, I cannot compile the player to be identical to the release version.  Random functionality is lost, like the time display and scrub bar for "streaming" rtmp media,  Not sure why I cannot compile an identical AkamaiFlashPlayer.swf from the AkamaiMultiPlayerExample.fla.  Even without making any changes to the code other than commenting out the newsource line.

     
  • Dan Sparacio
    Dan Sparacio
    2010-08-03

    Pablo,

    OK,  let me look into it and get back to you.  I will try to put up an example this week if not today or tomorrow.

    Thanks, 

    Dan

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-03

    Thank you very much! Any help is very much appreciated!

     
  • Dan Sparacio
    Dan Sparacio
    2010-08-30

    Pablo,

    Please excuse my delay in posting a code example for you question, I have not forgotten about you! Have you had any luck with your issue?

    Thanks,

    Dan

     
  • Paul Lunneberg
    Paul Lunneberg
    2010-08-30

    Not a problem… I've also been caught up in other projects.  The biggest problem I have currently is…. Compiling the bundled .FLA results in a .SWF that is functionally different that the precompiled .SWF player file.  If the resizing gets fixed in the next version of the player so the player can be resized after embedding, that would solve my problem completely! 

     
  • Irene Hu
    Irene Hu
    2010-09-09

    Hi,

    Has anyone found a fix to this?

    Thanks,
    Irene

     
  • Dan Sparacio
    Dan Sparacio
    2010-09-09

    Irene,
    not yet - I have not had a chance yet to look at this issue.  Any insight into the issue?
    Thanks,
    Dan

     
  • Irene Hu
    Irene Hu
    2010-09-09

    Sorry, I am still a beginner w/ AS and only hacked my way through getting the player together. Happy to help otherwise. :)

     
  • Dan Sparacio
    Dan Sparacio
    2010-09-14

    OK,  so it looks like there was a change in version 2.12 to 2.13 (thanks pablosbrain ) and the stage listener was taken out -  I need to find out more about this change but I am on the trial and this should be resolved in the next release.. If i have a solution I will post it here asap so you do not have to wait for the next release.   

    Thanks

    Dan

     
  • Dan Sparacio
    Dan Sparacio
    2010-09-15

    I think there is two parts to this thread so ill try to answer them individually.

    Part one:
    Recompiling problems

    Also… when compiling the AmakaiMultiPlayerExample.fla it doesn't have all the functionality of the AkamaiFlashPlayer.swf release version. It compiles smaller and some of the text doesn't display. Not sure why its different. Not sure what is used to compile the AkamaiFlashPlayer.swf.

    Can you make sure you have all the correct fonts installed when trying to recompile the player?

    Fonts needed are:
    LCD2Bold
    Arial
    ArialBold

    How are you compiling - Flash w/fla, Flex/Flash builder, or command line?


    Part Two:
    Dynamically resizing the player after embedding in html page.
     

    I added some code into the AkamaiMultiPlayerExample.as Class that will come out in the next release but the idea is this:

    A solution is:

    private function onResize(event:Event):void
    {       
        player.resizeTo(stage.stageWidth, stage.stageHeight);
    }
    

    Then in this method add  a listener to the stage for the new function after you remove the onStageResize listener

    private function onStageResize(e:Event):void 
    {
                if (stage.stageWidth > 0 && stage.stageHeight > 0)
                {
            //after we remove the init stage resize listener
            stage.removeEventListener(Event.RESIZE,    onStageResize);
                     //we add a new listener for the html resize event…(when setting the 
                     //width and height embed tag to 100%)
                stage.addEventListener(Event.RESIZE,  onResize);
    

    One other thing is we need to do is remove the listener if we go into fullscreen and add it back when we exit fullscreen. 


    Entering fullscreen:

    private function handleFullscreen(e:Event):void
     {
                if (stage.displayState == StageDisplayState.NORMAL)
                {
            //remove stage listener here to during fullscreen
            stage.removeEventListener(Event.RESIZE,    onResize);
    


    Exiting fullscreen:

    private function exitFullScreen(e:FullScreenEvent = null):void
     {
                if (e && !e.fullScreen)
                {
            //since we remove the stage listener on fullscreen we add it back here
            stage.addEventListener(Event.RESIZE,  onResize);
    

    Note*** There is an init stage resize event used to resolve an IE bug and that is what changed from version 2.12 – 2.13 like you pointed out in an earlier post.  To clear things up, that change did not affect this issue.  It must have been change in a different version,  I am still looking into that.

    Thanks,

    Dan

     
  • Dan Sparacio
    Dan Sparacio
    2010-10-19

    Should be all set with the new release of OVP 2.1.5 - 
    You can get a new compiled swf here

    In regards to your compile size - are you using Flash CS 5 ?  We noticed that the compile size of the multi player is almost 3xs the size  (319kb vs 127kb) when compiled in CS5 rather than CS4!!

    Thanks

    Dan - OVP Team

     

  • Anonymous
    2010-11-05

    Hey dsparacio,
    I downloaded the .swf from the link you posted and it works great.

    Where can I get the .fla and .ae for that .swf?

    If I compile the example from the 2.1.5 release it has the same resize problems described above. The only thing that works is the .swf you linked to but I need to change out the player buttons and icons.

    Thanks!

     

  • Anonymous
    2010-11-05

    Hey Dan,
    Thanks, but I must be missing something. If I compile the .fla from the release (using AkamaiMultiPlayerExample.fla with AkamaiMultiPlayer.as) the resulting .swf will not scale the content correctly (the controls get shrunk along with the video and it aligns left). My embed tag is has height/width is set to 100%.

    If I just swap out my compiled AkamaiMultiPlayer.swf with the one from the Konfigurator page then the video scales correctly. That is the only change I make, so something is wrong with my complied file, which leads me to believe there is something missing from the released .fla file (like the above code Dan posted isn't in AkamaiMultiPlayer.as). Or I messed up my compile, but it's pretty straight forward.

    Any thoughts?

    Thanks for the help!
    Drew

     
  • Dan Sparacio
    Dan Sparacio
    2010-11-05

    Drew,

    Try using the AkamaiMultiPlayerExample.as as your base application or document class.  All the code to handle the statge resize is in that class.  This is a bit confusing since the class name has example in it.. I will fix this confusion on the next release as more than just you have been confused by this.   when you open the fla AkamaiMultiPlayerExample is set as the default document class… this should work for you..

    Let me know.. Ill try to answer your other question about the Frame asap…

    Thanks

    Dan

     

  • Anonymous
    2010-11-08

    Hey Dan,
    Thanks for this. You're totally right. I just assumed that AkamaiMultiPlayerExample.as was not the full featured .as file and that AkamaiMultiPlayer.as was the file to use.

    Thanks again. As a side note, this player is very difficult to customize. I'm new to flash so that may be it, but compared with skinning a HTML5 JS player this is crazy difficult.

    -Drew