Posts Tagged ‘cue points’

Cue point improved

Monday, November 3rd, 2008

I just discussed in the previous post about actionscript cue points. We however found out that they had limitations – they are not very accurate.

To be sure to get exactly synchronised with the frame of the video you want to, you better use Event cue points – which needs to be added in the flv itself – using for example AfterEffects.

You then add listeners the same way than with actionscript cue points.:

this.videoComponent.addEventListener(MetadataEvent.CUE_POINT, _handleCuePoint);

Video cue points

Wednesday, October 29th, 2008

If you want to trigger some events at certain times of a playing video, an easy solution is to use cue points.

You need to

a) place an instance of the VideoPlayer component on the stage

b) on the as file for your animation, add cue point on the video:

this.videoComponent.addASCuePoint(5, "firstCuePoint");
this.videoComponent.addASCuePoint(10, "secondCuePoint");

This add 1 cue point at 5.00 seconds of the video, and another at 10.00 seconds

c) add a listener

this.videoComponent.addEventListener(MetadataEvent.CUE_POINT, _handleCuePoint);

d) on the listening function, find out which cue point was triggered, and play along!

private function _handleCuePoint(pEvent:MetadataEvent) {
trace("CUE POINT REACHED!");
if (pEvent.info.name == "firstCuePoint"){
  //do something regarding the first cue point
}else{
  //do something regarding the second cue point
}
}