0 Replies Latest reply on Apr 1, 2010 9:59 AM by leaflashdev

    osmf multiple video

    leaflashdev Level 1

      Hello ,


      I am trying to load two video in the same movie clip

      I have 4 screens


      some of the screen has 1 video some as two


      It is working good , when I switch from 1 screen to another the video get erase


      But when I open the Activity monitor

      I can see that the real memory keep increased as you use the program

      Its like something its not erased properly(maybe on the cleanVideo)


      Here is my code


      Thank you



      private var arrayVideos=[["videos/Intro.flv",null],["videos/Conclusion.flv","videos/Intro.flv"],["vid eos/Into.flv",null],["videos/Conclusion.flv","videos/Intro.flv"]];


      if (arrayVideos[i-1][1]!=null) {


                      } else {





      public function MyWebPlayer(i) {


                  if (myPlayer) {
                      if (myPlayer.mediaPlayer.media!=null) {
                  if (myPlayer2) {
                      if (myPlayer2.mediaPlayer.media!=null) {


                  myPlayer=new videoController(arrayVideos[i-1][0],mainMc,0,i);




              public function MyWebPlayer2(i) {
                  myPlayer2=new videoController(arrayVideos[i-1][1],mainMc,500,i);






      and here is the videoController class



          import flash.display.MovieClip;
          import org.osmf.containers.MediaContainer;
          import org.osmf.media.*;
          import org.osmf.layout.LayoutMetadata;
          import org.osmf.elements.VideoElement;
          import org.osmf.net.NetLoader;
          import org.osmf.events.*;
          public class videoController
              private var mediaFactory:MediaFactory;
              private var mediaElement:MediaElement;
              public var mediaPlayer:MediaPlayer;
              private var mediaContainer:MediaContainer;
              public function videoController(VIDEO_URL:String, mainMC:MovieClip, position:Number,id:Number)
                  init(VIDEO_URL,mainMC, position,id)
              public function init(VIDEO_URL:String, mainMC:MovieClip, position:Number,id:Number){
                  mediaFactory = new DefaultMediaFactory();
                  mediaElement = mediaFactory.createMediaElement(new URLResource(VIDEO_URL));
                  var layout:LayoutMetadata = new LayoutMetadata();
                  mediaElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layout);
                  mediaPlayer = new MediaPlayer();
                  mediaPlayer.media = mediaElement;
                  // mediaPlayer.addEventListener (MediaPlayerCapabilityChangeEvent.
                  mediaContainer = new MediaContainer();
                  var clip = mainMC.addChild(mediaContainer );
                  clip.x = ((id - 1) * 1024)+position;
              public function cleanVideo(){