TL DR version: How do i use NetStream onSeekPoint event to construct a seek point table?
Full question below. Situation: flv streaming video player in data generation mode, i.e. NetStream.play(null) and then NetStream.appendBytes(bytes:ByteArray). Doing so, you can seek at only specific points of the video (so called "tags" or "seek point"). See seeking not working in flex 4.5 netStream byteArray if you don't know what I'm talking about.
So, if you can build the tags table from the onMetaData event, as explained in the link above, everything works. But, in theory, if your video file does not have the metadata (and for some reason you can't preprocess the file injecting the metadata with an injector tool, as suggested in the link above), you should be able to build the tags table "on the fly" with NetStream onSeekPoint event:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onSeekPoint (..."Use this event to construct a seek point table") [watch out for filters at the top of the adobe page, they may hide properties and functions of the class...!]
Problem: onSeekPoint is explained really poorly. It says "The byteCount corresponds to the byteCount at the first byte of the parseable message for that seek point, and is reset to zero as described above." Well, above (where?!) is described nothing, and "byteCount" is not defined at all (these are the only two instances of "byteCount" in the whole page!).
I've discovered (see onSeekPoint weirdness - example 1) that the handler onSeekPoint receives two objects, that are simply two int, 0 and 1.
What am I supposed to to now?
I've found nothing else on the subject, hope someone can help, thanks.
I forgot: trying to read, when the onSeekPoint event is triggered, NetStream.time and NetStream.bytesLoaded ("The number of bytes of data that have been loaded into the application") is useless since bytesLoaded is constantly 0 (i guess it is another "undocumented feature" of the data generation mode - good job Adobe!)
You need to use the following:
public function onSeekPoint(time:Number,position:uint):void
{
var data:Object=new Object();
data.time=time;
data.position=position;
seekPoint_arrC.addItem(data);
}
seekPoint_arrC is a "ArrayCollection" Object.