Search code examples
androidaudioloopsmedia-playerogg

Playing ogg Sound with loop


I have a ogg sound in res/raw folder. I try play this sound with loop (without stop sound or cutting-clicks). I created OGG file and play with winamp or other music player and repeat perfectly. Also, I create metadata ANDROID_LOOP with value true in OGG sound file.

Code is basic:

...
mp = MediaPlayer.create(this, R.raw.sound);
mp.setLooping(true);
mp.setVolume(0, 0); // for initial fader, irrelevant
mp.start();
...

In Android 1.5, 1.6, ...., 2.3.X works fine!

But in my Samsung Galaxy S2, updated to Android ICS (4.0.3), I listen a small stop between loops.

Some idea?


Solution

  • Auto answer: In Android 4.0.4 works fine without changes. I assume that is a problem on Android [3.2, 4.0.3]? Possible bug?

    http://code.google.com/p/android/issues/detail?id=18756