5

I'm using an android MediaPlayer class right now for progressive audio streaming like this:

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(audioUrl);
mp.prepare();
mp.start();

But MediaPlayer class doesn't provide any caching, and I always need to do this routine: unnecessary network and battery waste

So, can someone help me find some library that will provide caching, because I couldn't find any. Thanks

Adel Nizamuddin
  • 823
  • 14
  • 31

2 Answers2

4

There are not currently any libraries (that I am aware of) that do caching for you. You'll basically need to create a proxy that reads in the data and writes it back out to the media player. In the proxy you can write your own caching layer. It's not simple but it's currently the only way to cache data. You can see an example of a proxy (although it doesnt cache) from NPR here.

Nick
  • 6,375
  • 5
  • 36
  • 53
2

Looking my projects:

  1. https://github.com/master255/ImmortalPlayer One thread to read, send and save to cache data. Most simplest way and most fastest work. Complex logic - best way!
  2. https://github.com/master255/VideoViewCache Simple Videoview with cache. Two threads for play and save data. Bad logic, but if you need then use this.
Master
  • 690
  • 6
  • 18