Streaming music and save cache file on local on Android

Viewed 4997

I use below code to play streaming music:

try {
    MediaPlayer mediaPlayer = new MediaPlayer();

    mediaPlayer.setDataSource(URL);
    mediaPlayer.prepare();
    mediaPlayer.start();
}
catch(Exception e) {
    e.printStackTrace();
}

I want to buffering file to local cache file at the same time.
And next time want to play this url music can play the local file directly.
How can I do it?
Or anyone can provide references?

0 Answers
Related