2 Replies Latest reply: Apr 10, 2012 3:02 AM by ism.boud RSS

    Strobe Media Playback in Flex.How to set width?

    shinjiss

      Hello.

       

      I use _parameters to set height and width. But Strobe Media Playback always fixed height and width to 100%.Thank you for helping

       

      My code:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx"

         minWidth="955"

         minHeight="600"

         applicationComplete="init()">

       

      <fx:Script>

      <![CDATA[

      import com.jodieorourke.flexosmf.*;

      import mx.core.UIComponent;

      import org.osmf.elements.VideoElement;

      import org.osmf.media.DefaultMediaFactory;

      import org.osmf.media.URLResource;

      import org.osmf.net.NetLoader;

      import spark.components.Button;

       

       

      private var _parameters:Object;

      private var comp:UIComponent=new UIComponent();

      private var smp:StrobeMediaPlayback=new StrobeMediaPlayback()

       

      private function init():void

      {

         _parameters={src: "http://osmf.org/configurator/videos/strobe.flv", width: 470, height: 320};

         smp.initialize(_parameters, systemManager.stage, systemManager.loaderInfo, null);

         comp.addChild(smp);

         cvas.addElement(comp)    

      }

       

      ]]>

      </fx:Script>

      <fx:Declarations>

       

      </fx:Declarations>

       

      <mx:Canvas id="cvas"

         width="50%"

         height="50%"

         backgroundColor="#FF0606">

       

      </mx:Canvas>

       

      </s:Application>

        • 1. Re: Strobe Media Playback in Flex.How to set width?
          Robert Reinhardt CommunityMVP

          This probably isn't the most elegant way to do it, but on videoRx.com, I use an embedded SMP within my Flex 4.1 app, and I added these properties to the StrobeMediaPlayback class (note that for this code, I'm using the 1.0 version of SMP):

           

          public function set videoWidth(value:Number):void {

          _videoWidth = value;

          if(mainContainer)

          mainContainer.width = videoWidth;

          if(controlBar)

          controlBar.width = videoWidth;

          }

           

          public function get videoWidth():Number {

          return _videoWidth;

          }

          public function set videoHeight(value:Number):void {

          _videoHeight = value;

          if(mainContainer)

          mainContainer.height = videoHeight;

          }

           

          public function get videoHeight():Number {

          return _videoHeight;

          }

           

          private var _videoHeight:Number;

          private var _videoWidth:Number;

           

          I then set videoWidth and videoHeight from the Flex app whenever I load a new video.

           

          HTH.

           

          -Robert

          • 2. Re: Strobe Media Playback in Flex.How to set width?
            ism.boud Community Member

            Hi Robert,

             

            I have used your code to set the width and height of my SMP (embedded in my Flex App). And it's working fine.

             

            But after using the full screen functionality, the player fill the application window and my initial values are not taken into account.

             

            Thank you for your help