joy_de_vivre
asked on
flex - displaying time of playing videos in HH:MM:SS:FF format
Hi!
I have some application which controls a flv video. I am using DateFormatter to format play time display and it is in HH:MM:SS format.
What I would like to do is to display it with HH:MM:SS:FF format (FF = frames: from 00 to 25).
Is this possible with DateFormatter or should i "fake" it somehow?
In addition, I am attaching part of code which is relevant to my problem..
Thanks for helping!
I have some application which controls a flv video. I am using DateFormatter to format play time display and it is in HH:MM:SS format.
What I would like to do is to display it with HH:MM:SS:FF format (FF = frames: from 00 to 25).
Is this possible with DateFormatter or should i "fake" it somehow?
In addition, I am attaching part of code which is relevant to my problem..
Thanks for helping!
private var start:Date;
private var timeDisplayFormatter:DateFormatter;
private function init():void{
start = new Date("1/1/2000");
timeDisplayFormatter = new DateFormatter();
playtime.text = "00:00:00:00";
loadedVideo.addEventListener(VideoEvent.READY,videoReady);
loadedVideo.addEventListener(VideoEvent.PLAYHEAD_UPDATE,updateTimeDisplay);
playButton.addEventListener(MouseEvent.CLICK, togglePlayback);
}
private function togglePlayback(event:MouseEvent):void{
if (loadedVideo.playing){
loadedVideo.pause();
} else if (loadedVideo.source){
loadedVideo.play();
}
}
private function videoReady(event:VideoEvent):void{
timeDisplayFormatter.formatString = "JJ:NN:SS";
var totalTime:Date = new Date(start.getTime()+ (this.loadedVideo.totalTime*1000));
videoLength = timeDisplayFormatter.format(totalTime);
}
private function updateTimeDisplay(event:VideoEvent):void{
timeDisplayFormatter.formatString = "JJ:NN:SS";
var currentTime:Date = new Date(start.getTime()+ (event.playheadTime * 1000) );
playtime.text = timeDisplayFormatter.format(currentTime);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER