PDA

View Full Version : Seeking Cue Points using NetStream


brianburgess
04-29-2008, 04:32 PM
I’ve been struggling with how to seek a specific cue point when I click a button. I’m using AS3 to load and control the video, and it traces the right data when the cue points are hit, but when I try to place the name of the cue point in the ns.seek(), it says the property is undefined. What am I missing here? Here is an example of the code:

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachNetStream(ns);

var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
listener.onCuePoint = function(evt:Object):void {
// instructions here
trace(evt.name);
trace(evt.time);
trace(evt.parameters);
trace(evt.type);

};

ns.client = listener;
ns.play(”flv/Instructional Video_Cue Points.flv”);

function clickHandler(event:MouseEvent):void {
//ns.seek(30);
//this works fine.
ns.seek(chp1);
//this gives the error: Access of undefined property chp1.

}

btn1.addEventListener(MouseEvent.CLICK, clickHandler);

brainstormwilly
04-29-2008, 04:42 PM
Brian, ns.seek() will only accept time in seconds as an argument. The NetStream object does not have cue point seeking built in. Only cue point capturing. In fact, only the FLVPlayer object has cue point seeking capability. I'm sure someone has deconstructed this object to find out how it's done, but I"ve not seen it.

brianburgess
04-29-2008, 04:59 PM
Thanks for the quick reply.

I was able to get it to use a variable. If I set "var chp1 = 3;" at the first, it will seek in 3 seconds, so is there a way to set the time for a cue point as a variable, and then use that variable? I'm just now migrating to AS3, so a lot of it is still lost on me. Is there a way to pull the data about the cue points when it loads and then use that data to set a variable?

brainstormwilly
04-29-2008, 05:19 PM
There must be a way since the FLVPlayer object can do it. I haven't delved into it to find out though.