This project has moved and is read-only. For the latest updates, please go here.

Caching downloaded mp3 files

Jun 26, 2014 at 12:15 AM
Hello guys,

I would like to implement mp3 caching in WP7 and WP8 apps. Any hints on how these libraries could help me with it?
Coordinator
Jun 26, 2014 at 11:33 PM
Are you simply looking to cache MP3 files or are you, for example, trying to record a live stream for later playback?
Jun 27, 2014 at 1:04 AM
Hello Henric,

Thanks for answering.

Yeah, just for caching mp3 files.
Coordinator
Jun 27, 2014 at 1:20 AM
You're welcome.

Then no, I don't think there is anything in phonesm that would help with what you're trying to do.

It probably doesn't need to be all that complicated. Do a GET with HttpClient then write the thing to isolated storage. Every once in a while, check the timestamps on the files to delete the old stuff.
Jun 27, 2014 at 5:36 AM
Henric,
Problem is: The app will be (most of times) running in low bandwidth connections. I can't wait the entire file to load before I start playing it.
That's why I thought some MediaStreamSouce implementation could be useful.
Coordinator
Jun 27, 2014 at 6:21 AM
Phonesm will stream them, but if you want it to also be able to cache things, you will need to do some customization. If you are only dealing with audio files, then I would suggest starting with the background audio sample app.

You would the either switch between phonesm for web streams and your own code depending on if you are playing a cached file or a stream, or give everything to phonesm but use a custom IWebReaderManager implementation that would either read from the network (like HttpClientWebReaderManager) or from isolated storage.