Question

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

}

Was it helpful?

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.

OTHER TIPS

It's probably due to the number of keyframes that the flv was encoded with (I think the number is 1 per 30 frames by default when encoding with MediaEncoder).

Try re-encoding the flv and set the Key Frame Distance to something smaller (or even embed the keyframe using Media Encoder rather than adding it via ActionScript).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top