4 Replies Latest reply on Jul 2, 2007 2:56 AM by Greg Dove

    NetStream.seek()

    Ady_Eaton
      Hi,

      I am having problems with using seek, I'll describe my problem, maybe someone can help.

      I have a 45 second FLV, when I receive the Meta Data it confirms this and returns 45 seconds for the duration.

      However if I seek to 40 seconds I get an NetStream.Seek.InvalidTime error, the message details indicates a maximum seek time of 33 seconds.

      Additionaly If I seek from 1 to 9 seconds, I get forced to start playback at 10 seconds. This can't be the intended behaviour, what can be going wrong?

      Many Thanks,
      Ady
        • 1. Re: NetStream.seek()
          crazyjoemilan Level 2
          to make sure its not the .FLV, get another (with different lengths) and load it in.

          If its not the FLV, check and make sure seek() doesn't use something wacky like miliseconds (I dont' think it does).

          If you're still stumped, post some code so we can have a looksee.
          • 2. Re: NetStream.seek()
            Greg Dove Level 4
            I'm pretty sure its not the duration property that you need to look at.
            The metaData should also have another property... which is
            canSeekToEnd

            which I think you will find is false.

            http://livedocs.adobe.com/flash/8/main/00002562.html#wp391201

            FLVs can only seek to the end if the very last frame if it is a keyframe.
            In fact they can only seek to keyframes (anywhere in the video) period (unless they are streamed with FMS), which I presume would also explain the behaviour of the 10 seconds from 1-9 . (Although that's a long time between keyframes - presumably in an effort to achieve high compression.)

            If you want to take a look at keyframes inside your flv and if you have the apollo/air runtime installed... I've found this to be a very useful tool
            RichFLV : http://www.richapps.de/


            • 3. Re: NetStream.seek()
              Ady_Eaton Level 1
              Hi Guys,

              Thanks very much for the help.

              I've tried a couple of different FLV's that used different encoding methods. Using the Video Encoder that comes with Flash, and outputting to the On2 VP6 codec appears to work as expected.

              However because this encoder does not run from the command line we are forced to use a third pary encoder when videos are uploaded to the site. Because the On2 VP6 codec is a protected codec this third party encoder can only use the Sorenson Spark codec. And it's on these FLV's that I am having these problems.

              GWD, I didn't realise that Key frames were part of an FLV, it looks like this is a problem with the encoder that we are using.

              Can anyone recommend a decent command line encoder?

              Many Thanks,
              Ady
              • 4. Re: NetStream.seek()
                Greg Dove Level 4
                quote:


                GWD, I didn't realise that Key frames were part of an FLV, it looks like this is a problem with the encoder that we are using.


                Just to clarify ... those are video keyframes (which are not the same as flash keyframes).

                Sorry I can't recommend one. ffmpeg/mencoder are open source implementations I think but I've never used them from the command line. Possibly that's what you're already using. They are I believe highly configurable, but that's the extent of my "knowledge" there.