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);

