Hi there,
You can skip the explanation if you want and look right at the code. Why is totalTime tracing out to NaN?
I have a custom UI for the playback component in a site I'm working on.
Users build a playlist of videos, press a "play" button, which initiates some animation leading up to the user seeing a video player component.
The UI works just fine, except for the FIRST video (and only sometimes, not everytime). When the FIRST video is playing, the scrubber and progress indicator do not do anything. You can't even click on them. After that, it works fine. Investigation revealed that the component's totalTime is tracing out to "NaN" when the scrubber stops working.
This is my progress and scrubber code:
ActionScript Code:
addEventListener(Event.ENTER_FRAME, v_status);
function v_status(e:Event):void {
// progress bar
var percPlayed:Number=mediaTable.vidPlayer.playheadTime/mediaTable.vidPlayer.totalTime;
if (mediaTable.vidPlayer.playing) {
debugTxt.appendText(String(percPlayed));
vidControls.progressBar.scaleX=percPlayed;
vidControls.scrubber.x=(vidControls.progressBar.width) - 22;
}
// buffer bar
var percLoaded:Number=mediaTable.vidPlayer.bytesLoaded/mediaTable.vidPlayer.bytesTotal;
vidControls.bufferBar.scaleX=percLoaded;
}