7 Replies Latest reply on Oct 17, 2010 10:40 PM by Amit Kumar

    Problem with blocking seek event in proxy element

    Amit Kumar Adobe Employee

      Hi All,

       

      I have Serial Element which has two media element and first one is proxy element so I want to block seek and time event for the first one and then unblock it as it finishes. So I am able to achieve it in case of time but with seek I am seeing problem that seek for second media element is getting blocked and for first media if I try to seek I get exception.

       

      Error: MediaPlayer - method called on null media or media that isn't seek

      at org.osmf.media::MediaPlayer/getTraitOrThrow()[C:\Documents and Settings\amit\My Documents\Flash Builder 4\OSMF\org\osmf\media\MediaPlayer.as:1244]

      at org.osmf.media::MediaPlayer/canSeekTo()

      [C:\Documents and Settings\amit\My Documents\Flash Builder 4\OSMF\org\osmf\media\MediaPlayer.as:794]

       

      Any idea what could be the reason?

       

      Regards,

      Amit

        • 1. Re: Problem with blocking seek event in proxy element
          bringrags Level 4

          It should be as simple as wrapping the first child in an UnseekableProxyElement, and adding both children to a SerialElement:


          var serial:SerialElement = new SerialElement();

          serial.addChild(new UnseekableProxyElement(new VideoElement(new URLResource(...))));

          serial.addChild(new VideoElement(new URLResource(...)));

           

          Does your code look different?  If so, can you post?

           

          The RTE you're getting is because you're calling MediaPlayer.seek() when MediaPlayer.canSeek is false.  You should check the latter property before calling seek().

          1 person found this helpful
          • 2. Re: Problem with blocking seek event in proxy element
            Amit Kumar Adobe Employee

            Yes you were right instead of checking MediaPlayer.canSeek I was checking MediaPlayer.canSeekTo(time). So that problem is resolved but again problem with second media element still persists I am not able to seek. Here is the code snippet :

             

            public

            class PreRollElement extends SerialElement

            {

            public function PreRollElement

            ( preRoll:MediaElement

            , contentPart:MediaElement

            )

            {

            super();

             

            addChild(

            new UnseekableProxyElement(preRoll));

            addChild(contentPart);

            }

            }

             

            Calliing seek in this way :

             

            protected function _onSeek( p_evt:ControlBarEvent ):void

            {

              var time:Number = p_evt.seekPercent * _mediaPlayerCore.duration;

              //if( _mediaPlayerCore.canSeekTo( time ) )

              if( _mediaPlayerCore.canSeek)

              {

                   if( _mediaPlayerCore.canSeekTo( time ) )

                   {

                        trace("Media Player can seek to clicked time.");

                        _mediaPlayerCore.seek( time );

                   }

                   else

                       trace("Media Player cannot seek to clicked time.");

              }

            }

             

            So for second element which should seek I am always getting "Media Player cannot seek to clicked time". Even I tried to seek directly as below but this also does not work:

             

            if

            {

            ( _mediaPlayerCore.canSeek)

                _mediaPlayerCore.seek( time );

            }

             

            It looks like Seek trait is there but not able to seek.

             

            Regards,

            Amit

            • 3. Re: Problem with blocking seek event in proxy element
              bringrags Level 4

              Not that you won't be able to seek to or within the second child until it has been loaded.  By default, OSMF doesn't preload every child of a SerialElement (because often the load correlates to a "play" on the server that serves the content, which can mess with analytics), children are loaded when the playhead reaches them.  To change this behavior, you can forcibly preload the children up front.  The ExamplePlayer sample app shows how to do this using a custom ProxyElement, see the "Serial Composition With Preloaded Subclips" example:

               

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

               

              (Note that opensource.adobe.com seems to be down right now, so if the above link doesn't work, you can access that source file from the OSMF ZIP.)

              • 4. Re: Problem with blocking seek event in proxy element
                Amit Kumar Adobe Employee

                Hi Brian,

                 

                I am not getting "Serial Composition With Preloaded Subclips" example. But I can "Serial Composition With Subclips" which does not look relevant to my problem. In the "Ad insertion" example I am seeing that initially for "OSMF_ANIMATION" there is no seek bar and both seek and time trait has been blocked for it and when it plays the "REMOTE_PROGRESSIVE" then seek bar comes and I am able to seek. Almost similar thing I am also doing so why it is not working for me? Can you provided few code snippets or point me to correct place in the osmf examples?

                 

                Regards,

                Amit

                • 5. Re: Problem with blocking seek event in proxy element
                  Amit Kumar Adobe Employee

                  Hi Brian,

                   

                  I got the example "Serial Composition With Preloaded Subclips" and I tried to use it but I got the below error when player tries to play second child. It looks like the trait has not been added so it throws error like below:

                   

                  play

                   

                  Error: The specified capability is not currently supported

                  at org.osmf.media::MediaPlayer/getTraitOrThrow()[C:\Documents and Settings\amit\Adobe Flash Builder 4\1.0gm\framework\OSMF\org\osmf\media\MediaPlayer.as:1293]

                  at org.osmf.media::MediaPlayer/play()[C:\Documents and Settings\amit\Adobe Flash Builder 4\1.0gm\framework\OSMF\org\osmf\media\MediaPlayer.as:756]

                   

                  Can you explain me in my case how it can be done like I have two child - one for ad and other normal video. I want to block seek and time for the first one and only time for the other one?

                   

                  Regards,

                  Amit

                   

                   

                   

                  • 6. Re: Problem with blocking seek event in proxy element
                    bringrags Level 4

                    Can you post your code?  I'm not exactly sure how you've modified the Serial Composition With Preloaded Subclips example.  I tried wrapping the first child in an UnseekableProxyElement, and it behaved correctly.

                    • 7. Re: Problem with blocking seek event in proxy element
                      Amit Kumar Adobe Employee

                      I updated the OSMF framework and it is working using AdProxy.as thanks Brian for your help.

                       

                      Amit