views:

491

answers:

4

Already finished implementing the player. I want to implement the progress bar. But I wonder if that's possible to do since we are streaming the music. Unless we are provided the length of the song before hand.

Please, I need your advice on this.

+2  A: 

Unless you are given the size (or time length) of the audio file beforehand, there's no way you can set the range of your progress bar (you'll have no max).

fbrereto
I see, thank you for your prompt reply
SimpleCode
A: 

Actually, I found a way to do that and I succeeded. That you calculate the number of frames per packet of the song, and the average packet's size (in bytes). Use NSHTTPConnection to get the file size and use this formular:

totalFrames = (fileSize * framesPerPacket / average packet size)

when you have total frames, just divide it by the bitrate, then u get urself the total time!!

SimpleCode
A: 

Hi, can u tell me how to get the average packet size

Thanks in advance, regards, Arun

arun