2 Replies Latest reply on Apr 1, 2010 5:58 AM by punknrollDD

    mediaPlayer.bytesLoaded returns 0

    punknrollDD

      Hi all,

       

      I want to have a graphical preloader for my osmf player. My Videos come from FMS 3.0 Server.

       

      I have a timer running to trace the loadedBytes like this:

       

          var netLoader:NetLoader = new RTMPDynamicStreamingNetLoader();
                      var dsResource:DynamicStreamingResource = new DynamicStreamingResource('rtmp://4xx.444.142.243/playlistx/');
                      var streamItems:Vector.<DynamicStreamingItem> = new Vector.<DynamicStreamingItem>();

       

      streamItems.push(new DynamicStreamingItem(vod+"_lq", 100 ));

       

                      streamItems.push(new DynamicStreamingItem(vod+"_mq", 600 ));

                      dsResource.streamItems = streamItems;

       

                      mediaElement=new VideoElement(dsResource, netLoader);

      mediaContainer.addMediaElement(value);

      ..

      ..

      mediaPlayer.media = mediaElement;

      ...

       

       

       

          public function onCurrentTimeChange( evt : TimeEvent ) : void
                  {
                      var playTrait:PlayTrait = mediaElement.getTrait(MediaTraitType.PLAY) as PlayTrait;

       

                      bufferTrait = mediaElement.getTrait(MediaTraitType.BUFFER) as BufferTrait;

       

                      if (bufferTrait && !bufferTrait.buffering && playTrait && playTrait.playState == PlayState.PLAYING)
                      {
                          //media player really plays the video
                          if(mediaPlayer.currentTime)
                          {
                              var percentIn : Number = evt.time / duration ;
                              var percentBufferIn : Number = (evt.time+bufferTrait.bufferLength) / duration ;

       

                                trace('mediaPlayer.bytesLoaded '+mediaPlayer.bytesLoaded);
                                trace('mediaPlayer.bytestotal '+mediaPlayer.bytesTotal);*/
                          }
                      }
                  }

       

      bytesTotal and bytesLoaded alwas returns 0 and I can't find any info in the documentation. Is this just working with progressive downloads?

       

      Thanx Andi