Skip to main content

progress bar

2 replies [Last post]
Joined: 2008-02-07
Points: 0

how to make progress bar during the movie??
i know how to calculate time, animate and etc, but what is the best way to loop it??


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-02-07
Points: 0

no tips??

Joined: 2007-06-25
Points: 0

Hi maciejka79,

In ClassX [i](implements ControllerListener as you want to redefine cotnrollerupdate(ControllerEvent e)[/i] :

[b]getPlayer().setMediaTime(new Time(0)); [/b]with getPlayer() return an instance of Player

Here you can get the duration of the media (when the info is updated) :

[b]public void controllerUpdate(ControllerEvent event) {
if (event instanceof {
duration = ((DurationUpdateEvent) event).getDuration();

Or you can use :
[b]if (player != null) {
return player.getDuration().getSeconds();
} [/b]

But be aware that sometimes (e.g. streaming ) this piece of information won't be available as the player starts.

with duration instance of Time.

Then you can get the current timecode with an instance of MediaTimePositionControl such as:

[b] timePositionControl = (MediaTimePositionControl) (getPlayer().getControl(""));[/b]

by using :

[b]public double getMediaTime() {
cur_time = timePositionControl.getMediaTimePosition();
return cur_time.getSeconds();

In the end, you know where you are, you know where you go (you may also know the duration without calling player.getDuration(), if you simply have the stream...), so you have %done = current/total.