Detect NetStream events with AS3 Video Object (not component)
Posted
by JFOX
on Stack Overflow
See other posts from Stack Overflow
or by JFOX
Published on 2010-01-11T18:57:47Z
Indexed on
2010/03/19
6:01 UTC
Read the original article
Hit count: 331
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?
© Stack Overflow or respective owner