0 Replies Latest reply on Mar 3, 2010 12:58 AM by bugreport22

    MediaPlayer with OSMF and Flex

    bugreport22 Level 1

      Hello,

       

      Im trying to build an Media Player with Adobe Flex. Im using OSMF to realize it but I have a problem with Flex created SWF Files. Its not possible to lad it. When Im Loading a clean AS3 SWF File its not a problem only loading Flex created SWFs. Here is my sample code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" initialize="initApp();" width="1920" height="1080" layout="absolute">
           <mx:Script>
                <![CDATA[
                     import mx.events.FlexEvent;
                     import mx.core.Application;
                     import org.osmf.containers.MediaContainer;
                     import org.osmf.media.MediaPlayer;
                  import org.osmf.utils.URL;
                     import org.osmf.media.URLResource;
                     import org.osmf.proxies.TemporalProxyElement;
                     import org.osmf.composition.SerialElement;
                     import org.osmf.media.*;
                     import org.osmf.swf.*;
                     import mx.core.UIComponent;
                     private static const swfUrl:String = "cwcam.swf"
                     private var mediaElement:MediaElement;
                  private var mediaPlayer:MediaPlayer;
                  private var container:MediaContainer
                        var serialElement:SerialElement;
                     public function initApp():void {
                          var mySWFURL:URL = new URL(swfUrl);
                          serialElement = new SerialElement();
                          container = new MediaContainer(); 
                          serialElement.addChild(new TemporalProxyElement(4,new SWFElement(new SWFLoader(), new URLResource(mySWFURL))));
                          container.addMediaElement(serialElement); 
                          videoParent.addChild(container);
                          mediaPlayer = new MediaPlayer( serialElement );
                     }
      
      
                ]]>
           </mx:Script>
            <mx:UIComponent id="videoParent" visible="true" width="1920" height="1080"/>     
           </mx:WindowedApplication>