3 Replies Latest reply on Jul 24, 2007 1:57 PM by Newsgroup_User

    Maintain Video Aspect Ratio

    Matt_Blubaugh Level 1
      I was wondering first of all, if there is a built-in parameter to detect the native size of a video file in Flash. Currently, the video player with which I'm working scales any video clip to the size of the video instance. So, for example, if I am using the 16:9 version of my player and I try to play a 4:3 video, it will stretch to fit the entire video window. Is there a way to restrict the video from resizing and to have it play in it's original resolution?

      Second, is there a way that I can add upon this by having a button that will resize the video and maintain the aspect ratio similar to something you'd see on YouTube? I'm most interested in doing this without having to hard code values.

      It would be great to provide just the 16:9 version of my video player instead of having to swap swfs depending upon the size of the video that needs to be played. Or even better yet, to just have the video window scale according to the resolution of the video requested.

      Thanks for any help.
        • 1. Re: Maintain Video Aspect Ratio
          Level 7
          Hi Matt,

          You would most likely need to get the video information from the
          MetaData. There's an indepth answer available here:
          http://www.journalb.com/?p=7

          For Flash 8, you would simply change the "client" property to "onMetaData".

          Saving these values, you could then adjust the width and height of the
          containing movie clip dynamically and continue to maintain the correct
          aspect ratio.

          If you're interested, I can post the equations to maintain aspect at any
          size.

          Patrick

          Matt Blubaugh wrote:
          > I was wondering first of all, if there is a built-in parameter to detect the
          > native size of a video file in Flash. Currently, the video player with which
          > I'm working scales any video clip to the size of the video instance. So, for
          > example, if I am using the 16:9 version of my player and I try to play a 4:3
          > video, it will stretch to fit the entire video window. Is there a way to
          > restrict the video from resizing and to have it play in it's original
          > resolution?
          >
          > Second, is there a way that I can add upon this by having a button that will
          > resize the video and maintain the aspect ratio similar to something
          > you'd see on YouTube? I'm most interested in doing this without having to hard
          > code values.
          >
          > It would be great to provide just the 16:9 version of my video player instead
          > of having to swap swfs depending upon the size of the video that needs to be
          > played. Or even better yet, to just have the video window scale according to
          > the resolution of the video requested.
          >
          > Thanks for any help.
          >

          --
          http://www.baynewmedia.com
          Faster, easier, better...ActionScript development taken to new heights.
          Download the BNMAPI today. You'll wonder how you ever did without it!
          Available for ActionScript 2.0/3.0.
          • 2. Re: Maintain Video Aspect Ratio
            Matt_Blubaugh Level 1
            Thanks Patrick, I'll check that thread out you linked me to.

            I'm certainly interested in any help you'd like to provide, so the aspect ratio equations would be much appreciated.



            • 3. Re: Maintain Video Aspect Ratio
              Level 7
              Check back later on the site link. I'll update that post to include
              aspect ratio calculations.

              Patrick

              P.S. Video is my specialty so fire away with any questions you may have.
              Here's my pet project: http://www.peabee.com/blog

              Matt Blubaugh wrote:
              > Thanks Patrick, I'll check that thread out you linked me to.
              >
              > I'm certainly interested in any help you'd like to provide, so the aspect ratio equations would be much appreciated.
              >
              >
              >
              >

              --
              http://www.baynewmedia.com
              Faster, easier, better...ActionScript development taken to new heights.
              Download the BNMAPI today. You'll wonder how you ever did without it!
              Available for ActionScript 2.0/3.0.