1 Reply Latest reply on Jan 3, 2011 1:49 PM by Andrian Cucu

    sound scratching on VideoElement preload

    kioshin10

      Hello,

       

      I try to prelaod VideoElement in this way:

       

                  mediaPlayer.media = mediaElement;
                  mediaPlayer.muted = true;
                 
                  mediaPlayer.addEventListener(LoadEvent.BYTES_LOADED_CHANGE, traceBytes);

       

                  public function traceBytes(event:LoadEvent):void {
                     
                      trace(" BYTES LOADED of the media: " + mediaPlayer.bytesLoaded );
                      trace(" BYTES TOTAL of the media:  " + mediaPlayer.bytesTotal    );
                     
                      if (mediaPlayer.bytesLoaded == mediaPlayer.bytesTotal) {
                         
                          playMediaLoaded();

       

                      }
                     
                  }

       

              // Play prelaoded media
              public function playMediaLoaded():void {
                 
                      mediaPlayer.pause;           
                      mediaPlayer.seek(0);
                      mediaContainer.addMediaElement(mediaElement);
                     
                      mediaPlayer.play;
                      mediaPlayer.muted = false;
                      mediaPlayer.loop = true;

       

              }

      MediaPlayer just plays=preloads MediaElement not added to container untill mediaPlayer.bytesLoaded reaching mediaPlayer.bytesTotal.

      Everything works fine except strange sound scratching effect sometimes while preloading. How could it happen? mediaPlayer is mutted..

      Even mediaPlayer.volume = 0 doesn't help. I could work with AudioTrait, but mediaElement.hasTrait(MediaTraitType.AUDIO) is true only after

      mediaElement is prelaoded.

      Are there any other settings available?

       

      Thank you in advance,

      kioshin10