Sound.duration problem

I am working on a music player where the music list is loaded using xml. I am using sound object and the streaming property is set to ‘true’. Now I want to calculate sound.duration, but I don’t get the actual value when it is streaming, probably because the entire file is not downloaded at once because of streaming, and it is returning the duration of the portion of the file downloaded. So I am unable to develop a progress bar which shows the current position of the music.
I even tried to get the file duration using ID3 tag but the TIME property does not seem to work either.
Another options could be using php to get the duration of the mp3 file and generate an xml file which specifies the duration of the file.
But I have a little idea about php.
Can anyone help me