Position of the Playhead

NetStream.time returns the position of the playhead, in seconds. I was under the impression that this could be any value. It turns out, as everything is quantized, the playhead moves from tag to tag in a FLV.

So you can be sure that there’s a tag with the timestamp at every NetStream.time value you read. If there’s no tag with a particular timestamp, NetStream.time won’t return that value.

That explains why NetStream.time will return the timestamp of the last tag at the end of a FLV playback, and not the actual duration of the FLV (FLV files always start at time 0). We have added the lasttimestamp value to the metadata injected by our free FLV MetaData Injector tool fairly recently, but I thought this was something odd that happened only at the end of a FLV…

This entry was posted in Flash.

2 Responses to Position of the Playhead

  1. Rob Walch says:

    Awesome! The time never reaching duration was a big one for me! I guess ‘lasttimestamp’ is also the greatest value that you can seek to without the netstream hanging in seek mode?

  2. Hi Rob,
    With FLVMDI 2.0 (currently public beta) we have ‘lastkeyframetimestamp’ value which should be the last time you can seek without hanging (it’s the timestamp of the last video key frame in the FLV).
    ‘lasttimestamp’ is what it says, the timestamp value of the last tag in the FLV file. NetStream.Time will return this value, rather than the duration, so it’s more useful than the ‘duration’ when detecting the FLV end.
    Best regards,
    Burak