mardi 20 janvier 2015

android repeat sound lag

I am working on a application in which i have to play a horn sound and i am having a sound clip of it. Now i want to play this sound file in a loop but i am getting a second lag once its repeat the same file. I am using media player class to play the sound.


Please let me know how i can remove this lag to play a sound file without a lag.



final MediaPlayer mp_horn1 = MediaPlayer.create(this, R.raw.horn_wf);
mp_start.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp_start.start();
}
});

Aucun commentaire:

Enregistrer un commentaire