2

I want to play a "wav" file of 1 seconds multiple times without gap. All my attemps failed. My existing code is as follows;

MediaPlayer mMediaPlayer = MediaPlayer.create(this, R.raw.my5s);
MediaPlayer mMediaPlayer2 = MediaPlayer.create(this, R.raw.my5s);
mMediaPlayer.setVolume(1, 1);
mMediaPlayer.setLooping(true);
this.mMediaPlayer.setNextMediaPlayer(mMediaPlayer2);

this.mMediaPlayer.start();

I also tried the solutions in the following links;

  1. play .ogg file
  2. manual looping
Community
  • 1
  • 1
dursun
  • 1,861
  • 2
  • 21
  • 38
  • 3
    Did you consider using SoundPool instead, it is well suited for this sort of thing (low latency playback) – k2col Dec 20 '14 at 18:53
  • thank you that saved my day. with soundpool I managed to solve my problem. – dursun Dec 20 '14 at 20:19

1 Answers1

-1

Add this to program

mMediaPlayer.perpare();
Pang
  • 9,564
  • 146
  • 81
  • 122