Search code examples
actionscript-3streamingpointsflvcue-points

Flash a3 - stopping at a cue point


I have an flv vid and set the cue point dynamically

vid.addASCuePoint(1, "cuePoint1");

How ever it does not always stop in the same place. How can I be more exact? I take this is due to buffering and a few other factors?

import fl.video.*;
//etc etc 
vid.addEventListener(fl.video.VideoEvent.READY, flvPlayback_ready);
vid.addEventListener(MetadataEvent.CUE_POINT, flvPlayback_cuePoint);

function flvPlayback_ready(evt:fl.video.VideoEvent):void {
vid.addASCuePoint(1, "cuePoint1");
vid.play();
}


function flvPlayback_cuePoint(evt:MetadataEvent):void {
    vid.pause();
    trace("CUE POINT!!!");
    trace("\t", "name:", evt.info.name); // name: cuePoint1
   trace("\t", "time:", evt.info.time); // time: 1
   trace("\t", "type:", evt.info.type); // type: actionscript

}


Solution

  • Cuepoints can be added to a video in two ways: 1) encoded into the actual video 2) added via actionscript

    I don't have any links to the appropriate documentation, but I've dealt with this problem before. The stuff I read says that adding cuepoints via actionscript will not be as accurate as encoding them onto the video. ...and your code indicates that this is how you are adding them...

    I wish I had better news for you, but the only way I am aware of to get more accuracy is to add the keypoints during encoding.