I am using Media player in my application, My application is totally depend on media player. I am streaming the music from the server. however, the streaming working perfectly.But I have to do some optimization as part of better performance of app and load balancing.I have to Stop buffering while user pause the music player.
Currently While i am playing the music player, music player Buffering can't stop while i pause the player. there is need to save bandwidth of the stream.It will save user data usage.and also server will save some process.
Please give me way how to stop buffering while music player pause?
however buffer will release on stop of music player.
My code is below
private MediaPlayer mMediaPlayer;
public String path = "mp3url";
mMediaPlayer = new MediaPlayer(this);
mMediaPlayer.setDataSource(path);
mMediaPlayer.prepare();
mMediaPlayer.start();
mMediaPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
@Override
public void onBufferingUpdate(MediaPlayer mp, int percent) {
// TODO Auto-generated method stub
Log.d("LOG", "Biffering update ||| "+percent);// it show that buffering cann't stop after pausing mediaplayer
}
});
Aucun commentaire:
Enregistrer un commentaire