Flv Video - duration and time

Just thought I’d post this to the forum for anyone doing flv video players. It’s code that I wrote to show the video playhead time next to the complete video time (00:42/4:38 format)

Thought it might help a lot of people.


myVideo.onEnterFrame = function() {
    minutes = Math.floor(myVideo.playheadTime/60);
    seconds = Math.floor(myVideo.playheadTime%60);
    totaltimeMin = Math.floor(myVideo.totalTime/60);
    totaltimeSec = Math.floor(myVideo.totalTime%60);
    
    timer = ((minutes>=10) ? minutes : "0"+minutes) + ":" + ((seconds>=10) ? seconds : "0"+seconds) + " / "+ ((totaltimeMin>=10) ? totaltimeMin : "0"+totaltimeMin) + ":" + ((totaltimeSec>=10) ? totaltimeSec : "0"+totaltimeSec);
    trace(timer);
}