views:

814

answers:

2

I have created a FLV video player using the AS3 flash.media.Video object (not the FLV playback component) and I am trying to listen for meta events and Cue Points embedded in the FLV video but I am not receiving any when I trace the movie. The cue points are not being created dynamically, they are in the FLV video.

Video embed code:

    // Initialize net stream
nc = new NetConnection();
nc.connect (null); // Not using a media server.
ns = new NetStream(nc);
// Add video to stage
vid = new Video(456,675);
addChild (vid);
// Add callback method for listening on
// NetStream meta data
client = new Object();
ns.client = client;
client.onMetaData = this.nsMetaDataCallback;
client.onCuePoint = this.onCuePoint; 
// Play video
vid.attachNetStream ( ns );
ns.play ("flv/00_010.flv");

callback handlers in the same class as the above code:

public function onCuePoint(info:Object):void { 
trace("cuePoint: time = " + info.time + " name = " + info.name + " type = " + info.type); 
if (ns) ns.pause();
}

public function nsMetaDataCallback (mdata:Object):void {
trace (mdata.duration);
}

Is there anything I am missing have wrong to capture events from my net stream?

A: 

That's pretty much exactly the same code that I have working. The only thing I can think of is the creation of the Video object itself. I have mine declared as a property of the class itself, although I can't really think why having the declaration in the function call would matter as it's still added to the stage.

I trust you see the video ok?

One rather silly guess would be to try switch the client assignment and attachNetStream calls if the attachNetStream call does something to the NetStream.

vid.attachNetStream ( ns )
ns.client = client;
client.onMetaData = this.nsMetaDataCallback;
client.onCuePoint = this.onCuePoint;
Matti
A: 

HI

I feel ur code is alright, but there might have some problem with the flv file itself. try with another file.

babulal