Skip to main content
Participant
January 8, 2008
Question

flash video: display elapsed time

  • January 8, 2008
  • 1 reply
  • 537 views
I am using the FLVPlayback component and one of the video templates from this site that uses screens. I want to display elapsed time/total time. I can't find a script to do that although i do find some if you don't use the FLVPlayback component.

any help would be much appreciated.
This topic has been closed for replies.

1 reply

mgk132
Participant
January 9, 2008
Hey Pat, I'm using something like this. You need to place the time() function on frame 1 and place the bottom code in an event or on a frame loop (while the video plays)

// assumes the FLV Playback component with an instance name - VideoPlayer

// time fiunction converts seconds to actual time
function time($seconds) {
if ($seconds !="Z") {
var $time:Number = $seconds;
var $min:Number = Math.floor($time/60);
//var $hrs:Number = Math.floor($min % 60);
var $sec:Number = $time % 60;
if ($sec <10 ) {
var $sec:String = "0"+$sec;
}
if ($min < 1 ) {
var $min:String = "";
}
var $timing:String = $min + ":" + $sec;
} else {
var $timing:String="";
}
return $timing;
}

// displays in a textfield- VidTime
VidTime.text = time(Math.floor(VideoPlayer.playheadTime))+" of "+time(Math.floor(VideoPlayer.totalTime));