Copy link to clipboard
Copied
Is there a way to show elapsed time on a component scrub bar (similar to the way VLC or Windows Media). I have a video that is linked and played through a component. There are several "skins" available, but none that I can find offer to read elapsed time. Is there code that can be applied to a component? If so, can you explain how to do that and what the code is?
Paul
you actually can. For me it's almost a decade ago that I did something like that with AS3 and don't remember all the details. But the rough line how to go about this is still memorized.
In the components panel in Animate below Video you find all single bits that make the FLVPlayback controls. PlayButton, PauseButton, PlayPauseButton, SeekBar and so on. You can create a movieclip and in it assemble all components you want in your user-defined video controls. Of course you have to connect the w
...Copy link to clipboard
Copied
Hi Paul
Are you targetting AS3 or HTML5 Canvas?
Klaus
Copy link to clipboard
Copied
AS3, I found the skin that has the counter, but it’s so laggy. And I cannot find how to edit those skins. If I could actually make it bigger I might be able to see it.
Copy link to clipboard
Copied
Paul
you actually can. For me it's almost a decade ago that I did something like that with AS3 and don't remember all the details. But the rough line how to go about this is still memorized.
In the components panel in Animate below Video you find all single bits that make the FLVPlayback controls. PlayButton, PauseButton, PlayPauseButton, SeekBar and so on. You can create a movieclip and in it assemble all components you want in your user-defined video controls. Of course you have to connect the wires to the interfaces, so to speak. Like this:
flvcomp.playPauseButton = videoCtrl.ppvid;
flvcomp.muteButton = videoCtrl.mutevid;
flvcomp.seekBar = videoCtrl.seekvid;
Whereby videoCtrl would be the linkage name (in the library) you've given the movieclip containing the FLVPlayback controls. ppvid, mutevid and seekvid would be the instance names you've given the component instances in the videoCtrl movieclip.
flvcomp would be the name under which you created the FLVPlayback component like:
var flvcomp:FLVPlayback = new FLVPlayback();
Well all those names were my choice when I created a user-defined FLVPlayback component for a particular app almost 9 years ago. You can choose names that suits you. The all important AS3 API for the component is to be found here: FLVPlayback - Adobe ActionScript® 3 (AS3 Flash) API Reference
Now the display for elapsed Time, there is no readymade component avail. But you can just create a dynamic textfield for it, place it too in your videoCtrl movieclip and instance-name it accordingly (Let's say ptime) and make it font-size-wise as large as you like. Creative Freedom. And then with some tricky bits of AS3 you can fill in the elapsed time. I give you as an orientation what I did back in 2010 (still works).
function updatePlayTime():void {
phSec = Math.floor(flvcomp.playheadTime);
phMin = Math.floor(phSec/60);
phSec2 = phSec - (phMin * 60);
if (phSec2 < 10) {
phSecStr = "0" + String(phSec2);
} else {
phSecStr = String(phSec2);
}
if (phMin < 10) {
phMinStr = "0" + String(phMin);
} else {
phMinStr = String(phMin);
}
videoCtrl.ptime.text = phMinStr + ":" + phSecStr + " / " + flvDurationStr;
var playProgress:int = Math.floor((videoCtrl.seekvid.progress_mc.width / 100) * flvcomp.playheadPercentage);
if (playProgress <= videoCtrl.seekvid.progress_mc.width) {
videoCtrl.seekvid.phprogress.width = playProgress;
}
}
You have to develop it yourself, this is only a guideline.
Klaus
Copy link to clipboard
Copied
So FLVPlayback components are merely Movieclips? Do you happened to actually have that component? I’m not an AS3 programmer, I’m just trying to create a Windows projector file with a video that can be scrubbed to a specific time. I do trial exhibits. I used to do them in AS2 which I was really good at. Now I have no choice but to use AS3. I started usining flash in 2006. I’ve never been asked for the time counter. I actually did see that in cc there is a playback component which has a “counter”. It would work for me but I’m pushing out 4K on my courtroom monitor and it gets so tiny I can’t see it. I don’t want to zoom in on run time because the video is almost full screen. I really appreciate your help. I’d even buy a custom made component if you were willing to help me build one.
Paul
Copy link to clipboard
Copied
Hi Paul
Yes I could build a custom component. We would have to collaborate: You design what you need, I develop it. But sorry mate, now it's late and I am in leisure time mode. I will send you a message first thing tomorrow morning.
Okay?
Klaus
Copy link to clipboard
Copied
Okay. I’ll put together what I need soon.