0 Replies Latest reply on Apr 23, 2011 2:56 AM by mattsmith_au

    Seeking a Parallel Element

    mattsmith_au

      Hi all,

       

      I'm currently working on a multilingual AlR project with video playback that supports multiple audio tracks. Each flv video file is accompanied by a seperate mp3 audio track for each language that the app supports. I need to sync the playback of the video with the appropriate audio track for the selected language.

       

      I have been able to get this to work by using a ParallelElement and adding the video/audio.

       

      However when I try to seek the playback to a specific time i get a 'The specified capability is not currently supported' error.

       

      If i add a listener for Media Player Capability Change:

       

      mediaPlayer.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE, doSeek);

       

      In the event hander, when I call seek on the media player, I do not get an error. However the video/audio does not seek.

       

      Does anyone have any advice on how I could get the seek behavior to work for a Parallel Element ? Do I need to manually add a trait the element? Or maybe to each media element individually?

       

      Cheers,

      M

       

      My code.....

       

       

      mediaContainer = new MediaContainer();
                     
      mediaPlayer = new MediaPlayer();
      mediaPlayer.addEventListener(MediaPlayerCapabilityChangeEvent.CAN_SEEK_CHANGE, doSeek);
                     
      var mediaFactory:DefaultMediaFactory = new DefaultMediaFactory();
                     
      var videoElement:MediaElement = mediaFactory.createMediaElement(new URLResource('assets/video/part1.flv'));
      var audioElement:MediaElement = mediaFactory.createMediaElement(new URLResource('assets/video/part1_aud_eng.mp3'));

       

      var parallel:ParallelElement = new ParallelElement();
      parallel.addChild(videoElement);
      parallel.addChild(audioElement);
                
      mediaContainer.addMediaElement(parallel);
                 
      mediaPlayer.media = parallel;
      // mediaPlayer.seek(10); // Throws error