Skip navigation
shinjiss
Currently Being Moderated

Strobe Media Playback in Flex.How to set width?

Mar 7, 2011 7:53 PM

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>

 
Replies
  • Currently Being Moderated
    Mar 14, 2011 1:16 PM   in reply to shinjiss

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2012 3:02 AM   in reply to ROBERT REINHARDT

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points