2 Replies Latest reply on Apr 26, 2010 9:02 AM by bringrags

    rewind when at swfelement in serialelement


      I have a serialelement with as last element a swfelement. In the swfelement there is a 'play again' button.


      mediaplayer.stop() or   mediaplayer.seek(0) are not working because the swfelement doesn't support play, seek or stop through the mediaplayer.


      What would be the best approach to do a play again ?


      Thanks for any pointers,






      I started with subclassing swfelement to SeekableSwfElement to add a SeekTrait, now we canSeek but I can't figure out how to make a seek(0) work on the 'whole' mediaplayer 



        • 1. Re: rewind when at swfelement in serialelement
          nyls Level 1

          Ok, so found it ;-))


          By adding also a timeTrait we have canSeek and canSeekTo(0) to do a seek(0) and then a play !!!



          public class SeekableSwfElement extends SWFElement {
                  private var timeTrait : TimeTrait;


                  public function SeekableSwfElement(resource:URLResource=null, loader:ImageLoader=null)
                  override protected function processReadyState():void
                      timeTrait = new TimeTrait();
                      addTrait(MediaTraitType.SEEK, new SeekTrait(timeTrait));
                      addTrait(MediaTraitType.TIME, timeTrait);
                  override protected function processUnloadingState():void

          • 2. Re: rewind when at swfelement in serialelement
            bringrags Level 4

            An even simpler approach is to wrap the SWFElement in a DurationElement.  DurationElement provides the custom SeekTrait, TimeTrait, PlayTrait, etc. that you ended up implementing.  To see how this works, take a look at the "Timed Image" example in the ExamplePlayer sample:


            http://opensource.adobe.com/svn/opensource/osmf/trunk/apps/samples/framework/ExamplePlayer /org/osmf/examples/AllExamples.as