views:

722

answers:

2

Hi

How can I save the current state of an audio file currently being streamed by my app. I want to start the song at the same place where the user left it (something like what Pandora does when listening to a song)

Right now I am getting the packet number being played. From the packet number I get the byte number and send it in the Range header field. But this does not work and returns the whole song right from the beginning.

I am using AudioFileStream and CFHTTPStream to stream the audio.

Thanks.

A: 

This really depends a lot on the capabilities of the streaming server. Most of the common streaming servers don't support range - like Shoutcast or Icecast.

John Fricker
Thanks John. How does Pandora do it then? They must be using the range param too in order to start the song from where the user left it?
lostInTransit
Pandora's magic is in the server. I would guess they've built their own from the ground up.
John Fricker
I checked with my server. It supports the Range header. So that is not an issue. Now how do I do it?
lostInTransit
+1  A: 

That's how we do it (although we use NSURLConnection). Sounds like your server isn't respecting the range header. Start debugging there -- the problem is either that your server doesn't support the range header or your client isn't sending it properly.

Neil Mix