1 Reply Latest reply on Aug 20, 2007 8:02 AM by Greg Dove

    Netstream Seek Delay

    chodda
      Afternoon,

      I don't know if anyone out there can help out with this but if you can it would be greatly appreciated. Basically I'm putting together a video editing tool using actionscript 3, and I'm having a few issues with the netstream seek command.
      I'm up to a point where the user can upload a video and then pick in/out points, I've got 2 buttons that capture the in and out values from wherever the current playhead position is, the values are then stored in a couple of variables, and then I have another button that uses those variables to play back the selected stretch of video from the "in point" to the "out point" by seeking to the time stored in the "in point" and playing to the "out point". It kinda works, but there is always a delay of between 2 and 8 seconds depending on the size of the video, has anybody else run into a problem like this, or is it just a case of the seek function being a bit unreliable? The code for it seems pretty straight forward, but I've pasted it in below anyway:

      //event listeners in and out point collection
      _in.addEventListener(MouseEvent.MOUSE_DOWN, captureIn);
      function captureIn(event:MouseEvent):void {
      _inPoint = _stream.time;
      }

      _out.addEventListener(MouseEvent.MOUSE_DOWN, captureOut);
      function captureOut(event:MouseEvent):void {
      _outPoint = _stream.time;
      }

      // Listener for seeking to the inpoint
      addClip.addEventListener(MouseEvent.MOUSE_UP, triggerPopulate);
      function triggerPopulate(event:MouseEvent):void {
      _stream.seek(_inPoint);
      captureThumb()
      }
        • 1. Re: Netstream Seek Delay
          Greg Dove Level 4
          I can't say for sure, but perhaps its because (unless things have changed in flash 9 compared with earlier players) you can only seek to a keyframe.

          So if your _inPoint and _outPoints are not on keyframes then you will get delays (although I didn't expect them to be as long as you seem to be experiencing) from your seeking to these values. I think (I've got 50% chance of being right without checking) that seek goes to either a keyframe at that timecode if there's one there or to the next keyframe after that timecode.

          You might want to do a search for an AIR application called richFLV. Perhaps its the type of thing you're trying to do.

          Also for keyframe information a tool called FLVMDI is quite handy. You can inject the flv with its keyframe data in the flv's metadata (so you can know precisely where they are). In as3 because you can get the videostream into a bytearray its possible to determine where they are by analysing the raw data in flash which is what the richFLV application does.