1 Reply Latest reply on Mar 15, 2010 11:45 AM by RyanOConnell

    Resizing Video Display

    KindOfBlue

      Hello all, Im just getting into the OSMF, and I wanted to ask a question.  How can I get control of my video display width and height?  My purpose is to adjust the height of the display so that I can get my controls underneath.

        • 1. Re: Resizing Video Display
          RyanOConnell Level 2

          Layout is controlled by using the MediaContainer, combined with LayoutMetadata.    The MediaContainer is the Display object you will add to your stage.  Once you create a MediaElement, such as VideoElement, you'll need to add it to the MediaContainer using addMediaElement like this:

           

          var video:VideoElement  = new VideoElement(new URLResource(REMOTE_STREAM));

          var container = new MediaContainer();

          container.addMediaElement(video);

           

          Now you'll add it to the display list:

           

          stage.addChild(container);

           

          //And size it to the stage:

          container.width = stageWidth;

          container.width = stageHeight;

           

          Now you can begin to play with the layout system.  To use the layout system you'll need to generate a LayoutMetadata object:

           

          var layout:LayoutMetadata = new LayoutMetadata();

          layout.layoutMode = LayoutMode.HORIZONTAL;

          layout.horizontalAlign = HorizontalAlign.CENTER;

          layout.verticalAlign = VerticalAlign.MIDDLE;

          layout.width = 640

          layout.height = 352;

          video.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layout);

           

          The above example will layout the Video in the center, using a widht of 640, and height of 352.  There are alot of other properties on layout metadata to configure, such as ScaleMode, that are all explained in the ASDocs, which i encourage all player developers to check out.