PDA

View Full Version : FLVPlayback complete event not triggering?


wu-tang
12-14-2007, 01:34 AM
I'm using the playback components and have noticed a lot of inconsistency in the complete event. My FLV always seems to stop a half second before the actual end of the file.

What I have detriment is that is where the audio track ends; however, there are a few more frame before the end so the complete event never runs.

Even if i put a cue point in there it still only triggers the cue point event if you drag the seekbar to the end. It seems to mess up if the cue point is to close to the end of the audio.

It's wacky... has anyone had this kind of problem before. The components are stock and code is simple so it is very strange.

If anyone has got any feedback I'd love to hear it. Thx:D


import mx.video.*;

video.playButton = controls.playbtn; // set playButton property to playbtn, etc.
video.pauseButton = controls.pausebtn;
video.backButton = controls.backbtn;
video.seekBar = controls.seekbar;

video.bufferTime = 0;
video.autoPlay = false;
//video.bufferingBarHidesAndDisablesOthers = true;//false;

var listenerObject:Object = new Object();

listenerObject.ready = function(eventObject:Object):Void {
controls._visible = true;
};

listenerObject.complete = function(eventObject:Object):Void {
_root.bb.onRelease();
}

listenerObject.cuePoint = function(eventObject:Object):Void {
trace("Elapsed time in seconds: " + video.playheadTime);
trace("Cue point name is: " + eventObject.info.name);
trace("Cue point type is: " + eventObject.info.type);

if(eventObject.info.name == "end") _root.bb.onRelease();
}

video.addEventListener("ready", listenerObject);
video.addEventListener("cuePoint", listenerObject);
video.addEventListener("complete", listenerObject);
video.contentPath = _parent.src;

acolyte
12-15-2007, 10:53 PM
Hi Wutang ,

the Problem you are suffering is called scopeShift
Once you are in the scope of the ListenerObject there is no _root to be known anyways

what i would trie is


var listenerObject = new Object();
listenerObject.root = _root;


and then in the onComplete

listenerObject.complete = function(eventObject:Object):Void {
this.root.bb.onRelease();
}


this.root only can be the root in the listenerObject

hope this helps