1 Reply Latest reply on Jun 11, 2007 8:58 AM by gjastrab

    Setting soundTransform on VideoDisplay

    gjastrab Level 1
      I have a component that uses the VideoDisplay class to play a video.
      It is added to my component in it's constructor as follows:

      /* --- VideoContent.as --- */

      import mx.containers.HBox;
      import mx.controls.VideoDisplay;

      public class VideoContent extends HBox {

      private var vid:VideoDisplay;

      /**
      * options.filename contains URL to the FLV to play
      */
      public function VideoContent(options:Object) {
      super();

      width = options.width;
      height = options.height;

      vid = new VideoDisplay();
      vid.autoPlay = vid.autoRewind = false;
      vid.maintainAspectRatio = true;
      vid.source = options.filename;
      vid.width = width;
      vid.height = height;

      addChild(vid);
      }

      }

      /* === VideoContent.as === */

      The video is playing correctly, stopping/starting when I want, etc.,
      but one of the FLVs I'm trying to load only plays out of the left channel.

      I've tried setting the appropriate properties on the soundTransform of
      the VideoDisplay, but it still only plays on the left channel. Is
      there another way to control the sound of a VideoDisplay that I'm missing?

      What I tried was (in the contructor):

      ...
      vid.height = height;

      vid.soundTransform.pan = 0;
      vid.soundTransform.leftToRight = 1;
        • 1. Re: Setting soundTransform on VideoDisplay
          gjastrab Level 1
          In case anyone was curious about this I got it to work by subclassing VideoDisplay and overriding the set soundTransform property to set it on the mx_internal videoDisplay property instead of for the Sprite:

          /* --- MyVideoDisplay.as --- */

          import flash.media.SoundTransform;
          import mx.controls.VideoDisplay;
          import mx.core.mx_internal;

          use namespace mx_internal;

          public class MyVideoDisplay extends VideoDisplay {

          override public function set soundTransform(st:SoundTransform):void {
          super.soundTransform = st;

          mx_internal::videoDisplay.soundTransform = st;
          }

          override public function get soundTransform():SoundTransform {
          return mx_internal::videoDisplay.soundTransform;
          }

          }

          /* === MyVideoDisplay.as === */