Skip to content Skip to sidebar Skip to footer

Android Stuttered Audio

I have a button when I clicked in it shows me an slide with a picture and plays an audio from my sd card with this code: public void buttonClickHandler(View v) { this.onClickNe

Solution 1:

Use MediaPlayer instead of StreamingMediaPlayer

for example:

MediaPlayer mp = new MediaPlayer();  
// when you want to play the sound stored in nodeaudio: // nodeaudio is a path like /min/sdcard/soundfile if (nodeaudio == null || nodeaudio.trim().equals("")) {                 
    mp.reset();             
} else {                 
    try {                 
        mp.reset();                 
        mp.setDataSource(nodeaudio);                 
        mp.prepare();                 
        mp.start();                 
    }                 
    catch(Exception e) {                     
        Log.e("Play sound ERROR", e.toString());                     
        e.printStackTrace();                 
    }             
}

Post a Comment for "Android Stuttered Audio"