ProblemYou want to listen for cue points encoded in the FLV. SolutionUse an onCuePoint( ) callback. DiscussionThe FLV format allows you to embed cue points within the file. You can use cue points for many purposes, such as:
You have to embed the cue points in the FLV file using one of the FLV encoders such as the Flash Video Exporter (which ships with Flash Professional), On2 Flix (http:// www.on2.com), or Sorenson Squeeze (http:// www.sorensonmedia.com). When playing back the video, the Flash Player receives a notification when a cue point is reached. As with metadata, cue points don't use the standard event model used by most of ActionScript 3.0. Rather, when a cue point is reached Flash Player calls a callback method called onCuePoint( ). As with onMetaData( ) the onCuePoint( ) method must be defined for an object that is assigned to the client property of the NetStream object. The onCuePoint( ) method accepts one parameter, which is an object with the following properties:
The following illustrates one way in which you can create a client object, assign the onCuePoint reference, and assign the client object to the NetStream object: var client:Object = new Object( ); client.onCuePoint = onCuePoint; videoStream.client = client; Then define the method appropriately: private function onCuePoint(cuePoint:Object):void { trace(cuePoint.name + " " + cuePoint.time); } See AlsoRecipe 16.4 |