2 Replies Latest reply on Mar 15, 2010 1:44 AM by bugreport22

    Preload all SerialElements

    bugreport22 Level 1

      Hello I'm using the SMIL Plugin to display content in a serial composition. The problem is that OSMF loads the next file when the file before has loaded and was displayed. I saw the a prelod example, but this is only for videos???

       

      It is possible to load all files before start playing? For example using the Queue Loader Class? To load all files in queue and then when complete lets start playing the files.

        • 1. Re: Preload all SerialElements
          bringrags Level 4

          Preloading should work for any MediaElement, including SMILElement, although you only need to do the play/pause calls for progressive video (to start the download).  Recommend you try it out, and let us know if you run into any problems with it.

          1 person found this helpful
          • 2. Re: Preload all SerialElements
            bugreport22 Level 1

            thx for your answer,

             

            the preload thing works now, but the first element is not beeing showed the duration long.

             

             

            here is my code:

             

            preload(durationAnimationElement,

            false);

            (parentMediaElement

            as CompositeElement).addChild(durationAnimationElement);

             

            if I do true here

            preload(durationAnimationElement,true);

             

            then he stoped after the first element

             

             

             

             

             

            private
            
            
             static function preload(mediaElement:MediaElement, doPlayPause:Boolean):void{
            
            var loadTrait:LoadTrait = mediaElement.getTrait(MediaTraitType.LOAD) as LoadTrait;
            
            
            if (doPlayPause){
            loadTrait.addEventListener(LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange);
            }
            
            loadTrait.load();
            
            
            
            function onLoadStateChange(event:LoadEvent):void{
            
            if (event.loadState == LoadState.READY){ 
            loadTrait.removeEventListener(LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange);
            
            
            
            var playTrait:PlayTrait = mediaElement.getTrait(MediaTraitType.PLAY) as PlayTrait;playTrait.play(); 
            playTrait.pause();
            }
            }
            
            }