I’m creating an mp3 player and need to grab the duration/length of an mp3 file I’m streaming.
This is what I’ve got so far:
var s:Sound = new Sound()
s.setVolume(100)
audiofile="music.mp3"
s.loadSound(audiofile,true)
So the above code sets up a sound object that streams. So I now need to get the duration of the mp3 file, so all tutorials say to use the following code.
s.duration
The problem is, when this is downloading from the internet the duration is not constant, the duration actually grows while it downloads more. It is not until the mp3 is totally downloaded that we get the full duration of the file.
is there any way I can get the total duration before if has finished downloading?