I would like to know what bitrate is song, so I count it this way:
var bitrate = Math.floor( 8*_snd.bytesTotal/_snd.length);
but unfortunately I can not retrieve valid value for _snd.length before all the song is loaded. Is there any other way to achieve that value?
Kindest Pawel
Since you are probably talking about the MP3 format, then there may be variable bit rate, where your formula will generate meaningless output. Second, streaming implies virtually endless file, so asking what the length of a possibly endless file makes for a poor question. However, in most cases the length of the sound may be known beforehand, if you know how much of it you are going to play.
But since your question is actually about the bit rate, not the length, I’d suggest that you maybe load the sound file using URLStream for example, and read the bit rate information from MP3 frames. It is the bits 17 through 20 of the MP3 frame.