Progressive audio caching library for Android

为君一笑 提交于 2019-12-09 13:15:17

问题


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


回答1:


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.



回答2:


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.



来源:https://stackoverflow.com/questions/12041994/progressive-audio-caching-library-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!