get duration on player

Hi,

I am using a jmf player to play an mpeg video. I want to knw the duration of the mpeg for which i use the getDuration() method. But this often returns DURATION_UNKNOWN. to get the duration I am puttin it in a while loop. But sometimes the complete duration is not obtained. How to do this?

I am attaching code snippet.

Thanks

/*start the player*/

player.start();

/*Define Time duration of mpeg/mp3 file*/

Time duration = player.getDuration();

/* Check proper time of playing file which is obtained

from function */

while(duration == Duration.DURATION_UNKNOWN){

duration = player.getDuration();

}

/*find the total time of the video/audio file in milliseconds*/

mpegTime = (int)(duration.getNanoseconds()/1000000);

[810 byte] By [javabb] at [2007-9-30 21:55:01]
# 1
I'm cluesess, but what about that thing with getNanoseconds()/1000000as nano- is one bilionth, don't you want times 1,000,000?
Zebediah at 2007-7-7 3:23:05 > top of Java-index,Administration Tools,Sun Connection...
# 2
the calculation for millisec is correct,,, but i am not able to get the complete value always... for ex: a 61000mS movie returns only 17000mS. How do I get the complete time...
javabb at 2007-7-7 3:23:05 > top of Java-index,Administration Tools,Sun Connection...